aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/IO/Url.h2
-rw-r--r--src/IO/http.c20
-rw-r--r--src/capi.c3
3 files changed, 16 insertions, 9 deletions
diff --git a/src/IO/Url.h b/src/IO/Url.h
index 15934e13..d9333d67 100644
--- a/src/IO/Url.h
+++ b/src/IO/Url.h
@@ -19,7 +19,7 @@ void a_Http_set_proxy_passwd(const char *str);
char *a_Http_make_connect_str(const DilloUrl *url);
const char *a_Http_get_proxy_urlstr();
Dstr *a_Http_make_query_str(const DilloUrl *url, const DilloUrl *requester,
- bool_t use_proxy);
+ int web_flags, bool_t use_proxy);
void a_Http_ccc (int Op, int Branch, int Dir, ChainLink *Info,
void *Data1, void *Data2);
diff --git a/src/IO/http.c b/src/IO/http.c
index d05c5b68..079f0a3c 100644
--- a/src/IO/http.c
+++ b/src/IO/http.c
@@ -262,13 +262,18 @@ static Dstr *Http_make_content_type(const DilloUrl *url)
* Make the http query string
*/
Dstr *a_Http_make_query_str(const DilloUrl *url, const DilloUrl *requester,
- bool_t use_proxy)
+ int web_flags, bool_t use_proxy)
{
char *ptr, *cookies, *referer, *auth;
Dstr *query = dStr_new(""),
*request_uri = dStr_new(""),
*proxy_auth = dStr_new("");
+ /* BUG: dillo doesn't actually understand application/xml yet */
+ const char *accept_hdr_value = web_flags & WEB_Image ?
+ "image/png,image/*;q=0.8,*/*;q=0.5" :
+ "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
+
if (use_proxy) {
dStr_sprintfa(request_uri, "%s%s",
URL_STR(url),
@@ -296,7 +301,7 @@ Dstr *a_Http_make_query_str(const DilloUrl *url, const DilloUrl *requester,
"POST %s HTTP/1.1\r\n"
"Host: %s\r\n"
"User-Agent: %s\r\n"
- "Accept: text/*,image/*,*/*;q=0.2\r\n"
+ "Accept: %s\r\n"
"%s" /* language */
"Accept-Encoding: gzip, deflate\r\n"
"%s" /* auth */
@@ -309,8 +314,9 @@ Dstr *a_Http_make_query_str(const DilloUrl *url, const DilloUrl *requester,
"%s" /* cookies */
"\r\n",
request_uri->str, URL_AUTHORITY(url), prefs.http_user_agent,
- HTTP_Language_hdr, auth ? auth : "", proxy_auth->str, referer,
- content_type->str, (long)URL_DATA(url)->len, cookies);
+ accept_hdr_value, HTTP_Language_hdr, auth ? auth : "",
+ proxy_auth->str, referer, content_type->str, (long)URL_DATA(url)->len,
+ cookies);
dStr_append_l(query, URL_DATA(url)->str, URL_DATA(url)->len);
dStr_free(content_type, TRUE);
} else {
@@ -320,7 +326,7 @@ Dstr *a_Http_make_query_str(const DilloUrl *url, const DilloUrl *requester,
"Host: %s\r\n"
"User-Agent: %s\r\n"
"%s"
- "Accept: text/*,image/*,*/*;q=0.2\r\n"
+ "Accept: %s\r\n"
"%s" /* language */
"Accept-Encoding: gzip, deflate\r\n"
"%s" /* auth */
@@ -333,7 +339,7 @@ Dstr *a_Http_make_query_str(const DilloUrl *url, const DilloUrl *requester,
request_uri->str, URL_AUTHORITY(url), prefs.http_user_agent,
(URL_FLAGS(url) & URL_E2EQuery) ?
"Cache-Control: no-cache\r\nPragma: no-cache\r\n" : "",
- HTTP_Language_hdr, auth ? auth : "",
+ accept_hdr_value, HTTP_Language_hdr, auth ? auth : "",
proxy_auth->str, referer, cookies);
}
dFree(referer);
@@ -355,7 +361,7 @@ static void Http_send_query(ChainLink *Info, SocketData_t *S)
DataBuf *dbuf;
/* Create the query */
- query = a_Http_make_query_str(S->web->url, S->web->requester,
+ query = a_Http_make_query_str(S->web->url, S->web->requester, S->web->flags,
S->flags & HTTP_SOCKET_USE_PROXY);
dbuf = a_Chain_dbuf_new(query->str, query->len, 0);
diff --git a/src/capi.c b/src/capi.c
index de338267..531ae34d 100644
--- a/src/capi.c
+++ b/src/capi.c
@@ -301,7 +301,8 @@ static char *Capi_dpi_build_cmd(DilloWeb *web, char *server)
if (strcmp(server, "proto.https") == 0) {
/* Let's be kind and make the HTTP query string for the dpi */
char *proxy_connect = a_Http_make_connect_str(web->url);
- Dstr *http_query = a_Http_make_query_str(web->url, web->requester,FALSE);
+ Dstr *http_query = a_Http_make_query_str(web->url, web->requester,
+ web->flags, FALSE);
if ((uint_t) http_query->len > strlen(http_query->str)) {
/* Can't handle NULLs embedded in query data */