diff options
author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2009-01-16 14:55:37 +0100 |
---|---|---|
committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2009-01-16 14:55:37 +0100 |
commit | 69e11e3ec87aa36e47100d4e9db02fdc039b5242 (patch) | |
tree | 221f5e2c6547788837b8bf223759031d637e0bcd /src | |
parent | aba09fd14b3f8a4a665d4f045e1b666803a90321 (diff) | |
parent | adb3d5c87fae7196dbae6c35828434cdcd6227a4 (diff) |
merge with main
Diffstat (limited to 'src')
-rw-r--r-- | src/IO/http.c | 15 | ||||
-rw-r--r-- | src/prefs.c | 8 | ||||
-rw-r--r-- | src/prefs.h | 1 |
3 files changed, 20 insertions, 4 deletions
diff --git a/src/IO/http.c b/src/IO/http.c index 328a8601..738937db 100644 --- a/src/IO/http.c +++ b/src/IO/http.c @@ -68,14 +68,19 @@ static Klist_t *ValidSocks = NULL; /* Active sockets list. It holds pointers to static DilloUrl *HTTP_Proxy = NULL; static char *HTTP_Proxy_Auth_base64 = NULL; +static char *HTTP_Language_hdr = NULL; /* - * Initialize proxy vars. + * Initialize proxy vars and Accept-Language header */ int a_Http_init(void) { char *env_proxy = getenv("http_proxy"); + HTTP_Language_hdr = prefs.http_language ? + dStrconcat("Accept-Language: ", prefs.http_language, "\r\n", NULL) : + dStrdup(""); + if (env_proxy && strlen(env_proxy)) HTTP_Proxy = a_Url_new(env_proxy, NULL); if (!HTTP_Proxy && prefs.http_proxy) @@ -231,6 +236,7 @@ Dstr *a_Http_make_query_str(const DilloUrl *url, bool_t use_proxy) "Connection: close\r\n" "Accept-Charset: utf-8,*;q=0.8\r\n" "Accept-Encoding: gzip\r\n" + "%s" /* language */ "%s" /* auth */ "Host: %s\r\n" "%s" @@ -240,8 +246,8 @@ Dstr *a_Http_make_query_str(const DilloUrl *url, bool_t use_proxy) "Content-Type: %s\r\n" "%s" /* cookies */ "\r\n", - full_path->str, auth ? auth : "", URL_AUTHORITY(url), - proxy_auth->str, referer, VERSION, + full_path->str, HTTP_Language_hdr, auth ? auth : "", + URL_AUTHORITY(url), proxy_auth->str, referer, VERSION, URL_DATA(url)->len, content_type->str, cookies); dStr_append_l(query, URL_DATA(url)->str, URL_DATA(url)->len); @@ -254,6 +260,7 @@ Dstr *a_Http_make_query_str(const DilloUrl *url, bool_t use_proxy) "Connection: close\r\n" "Accept-Charset: utf-8,*;q=0.8\r\n" "Accept-Encoding: gzip\r\n" + "%s" /* language */ "%s" /* auth */ "Host: %s\r\n" "%s" @@ -264,7 +271,7 @@ Dstr *a_Http_make_query_str(const DilloUrl *url, bool_t use_proxy) full_path->str, (URL_FLAGS(url) & URL_E2EQuery) ? "Cache-Control: no-cache\r\nPragma: no-cache\r\n" : "", - auth ? auth : "", URL_AUTHORITY(url), + HTTP_Language_hdr, auth ? auth : "", URL_AUTHORITY(url), proxy_auth->str, referer, VERSION, cookies); } dFree(referer); diff --git a/src/prefs.c b/src/prefs.c index 2c8ec5df..34d13db8 100644 --- a/src/prefs.c +++ b/src/prefs.c @@ -70,6 +70,7 @@ typedef enum { DRC_TOKEN_GENERATE_SUBMIT, DRC_TOKEN_GEOMETRY, DRC_TOKEN_HOME, + DRC_TOKEN_HTTP_LANGUAGE, DRC_TOKEN_LIMIT_TEXT_WIDTH, DRC_TOKEN_LINK_COLOR, DRC_TOKEN_LOAD_IMAGES, @@ -133,6 +134,7 @@ static const SymNode_t symbols[] = { { "generate_submit", DRC_TOKEN_GENERATE_SUBMIT }, { "geometry", DRC_TOKEN_GEOMETRY }, { "home", DRC_TOKEN_HOME }, + { "http_language", DRC_TOKEN_HTTP_LANGUAGE }, { "http_proxy", DRC_TOKEN_PROXY }, { "http_proxyuser", DRC_TOKEN_PROXYUSER }, { "http_referer", DRC_TOKEN_REFERER }, @@ -205,6 +207,10 @@ static int Prefs_parse_pair(char *name, char *value) a_Misc_parse_geometry(value, &prefs.xpos, &prefs.ypos, &prefs.width, &prefs.height); break; + case DRC_TOKEN_HTTP_LANGUAGE: + dFree(prefs.http_language); + prefs.http_language = dStrdup(value); + break; case DRC_TOKEN_PROXY: a_Url_free(prefs.http_proxy); prefs.http_proxy = a_Url_new(value, NULL); @@ -420,6 +426,7 @@ void a_Prefs_init(void) prefs.height = D_GEOMETRY_DEFAULT_HEIGHT; prefs.xpos = D_GEOMETRY_DEFAULT_XPOS; prefs.ypos = D_GEOMETRY_DEFAULT_YPOS; + prefs.http_language = NULL; prefs.http_proxy = NULL; prefs.http_proxyuser = NULL; prefs.http_referer = dStrdup("host"); @@ -485,6 +492,7 @@ void a_Prefs_init(void) */ void a_Prefs_freeall(void) { + dFree(prefs.http_language); dFree(prefs.http_proxyuser); dFree(prefs.http_referer); dFree(prefs.no_proxy); diff --git a/src/prefs.h b/src/prefs.h index 67607533..9156c815 100644 --- a/src/prefs.h +++ b/src/prefs.h @@ -22,6 +22,7 @@ struct _DilloPrefs { int height; int xpos; int ypos; + char *http_language; DilloUrl *http_proxy; char *http_proxyuser; char *http_referer; |