summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2009-01-16 14:55:37 +0100
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2009-01-16 14:55:37 +0100
commit69e11e3ec87aa36e47100d4e9db02fdc039b5242 (patch)
tree221f5e2c6547788837b8bf223759031d637e0bcd
parentaba09fd14b3f8a4a665d4f045e1b666803a90321 (diff)
parentadb3d5c87fae7196dbae6c35828434cdcd6227a4 (diff)
merge with main
-rw-r--r--ChangeLog1
-rw-r--r--dillorc9
-rw-r--r--src/IO/http.c15
-rw-r--r--src/prefs.c8
-rw-r--r--src/prefs.h1
5 files changed, 30 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index f18e5bb6..93eada34 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -24,6 +24,7 @@ dillo-2.1
- Switched file dpi error messages to HTML.
- Added a popup menu to form's submit button.
- Added a right-click menu to the form submit button (allows to show hiddens).
+ - Added the "http_language" dillorc option for setting HTTP's Accept-Language.
Patches: place (AKA corvid)
+- Switched SSL-enabled to configure.in (./configure --enable-ssl).
- Standardised the installation of dpid/dpidrc with auto* tools.
diff --git a/dillorc b/dillorc
index 215cdfdf..1d595d4f 100644
--- a/dillorc
+++ b/dillorc
@@ -99,6 +99,15 @@
# search_url="http://www.alltheweb.com/search?cat=web&query=%s"
#search_url="http://www.google.com/search?ie=UTF-8&oe=UTF-8&q=%s"
+# If set, dillo will ask web servers to send pages in this language.
+# This setting does NOT change dillo's user interface.
+# Format explained: www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.4
+# Language-REGION values: www.iana.org/assignments/language-subtag-registry
+# (by default, no Accept-Language header is sent)
+# http_language="de"
+# http_language="pt-BR"
+# http_language="vi,de-CH,de;q=0.5,th;q=0.3"
+
# Set the proxy information for http.
# WARNING: - HTTPS does not currently use the proxy settings.
# - FTP and downloads plugins use wget. To use a proxy with them,
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;