aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--dillorc12
-rw-r--r--src/IO/http.c8
-rw-r--r--src/prefs.c3
-rw-r--r--src/prefs.h1
-rw-r--r--src/prefsparser.cc1
6 files changed, 27 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 936886f1..e0b41ab4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,12 @@
Dillo project
=============================================================================
+dillo-2.2.1 [not released yet]
++- Configurable User-Agent HTTP header.
+ Patch: Alexander Voigt, corvid
+
+-----------------------------------------------------------------------------
+
dillo-2.2 [Feb 11, 2010]
+- Added keybindings for scrolling.
diff --git a/dillorc b/dillorc
index f7d48bdd..7045c269 100644
--- a/dillorc
+++ b/dillorc
@@ -140,6 +140,18 @@
# path : Send the requested URI's host and path.
#http_referer=host
+# Set the HTTP User-Agent header.
+# This can be useful for privacy and for working around servers who think
+# Dillo is less capable than it really is. However, if you pretend to use a
+# different browser, servers may send you pages that work with the features
+# and bugs of that other browser -- or even disallow access in cases like
+# wget or googlebot. Remember this before submitting bug reports.
+#
+# See http://zytrax.com/tech/web/browser_ids.htm for a compilation of strings.
+#
+# http_user_agent="Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6"
+# http_user_agent="Wget/1.11.4"
+#The default is Dillo/(current version number)
#-------------------------------------------------------------------------
# COLORS SECTION
diff --git a/src/IO/http.c b/src/IO/http.c
index 8518a392..67d552c8 100644
--- a/src/IO/http.c
+++ b/src/IO/http.c
@@ -312,13 +312,13 @@ Dstr *a_Http_make_query_str(const DilloUrl *url, bool_t use_proxy)
"Host: %s\r\n"
"%s"
"%s"
- "User-Agent: Dillo/" VERSION "\r\n"
+ "User-Agent: %s\r\n"
"Content-Length: %ld\r\n"
"Content-Type: %s\r\n"
"%s" /* cookies */
"\r\n",
full_path->str, HTTP_Language_hdr, auth ? auth : "",
- URL_AUTHORITY(url), proxy_auth->str, referer,
+ URL_AUTHORITY(url), proxy_auth->str, referer, prefs.http_user_agent,
(long)URL_DATA(url)->len, content_type->str,
cookies);
dStr_append_l(query, URL_DATA(url)->str, URL_DATA(url)->len);
@@ -336,14 +336,14 @@ Dstr *a_Http_make_query_str(const DilloUrl *url, bool_t use_proxy)
"Host: %s\r\n"
"%s"
"%s"
- "User-Agent: Dillo/" VERSION "\r\n"
+ "User-Agent: %s\r\n"
"%s" /* cookies */
"\r\n",
full_path->str,
(URL_FLAGS(url) & URL_E2EQuery) ?
"Cache-Control: no-cache\r\nPragma: no-cache\r\n" : "",
HTTP_Language_hdr, auth ? auth : "", URL_AUTHORITY(url),
- proxy_auth->str, referer, cookies);
+ proxy_auth->str, referer, prefs.http_user_agent, cookies);
}
dFree(referer);
dFree(cookies);
diff --git a/src/prefs.c b/src/prefs.c
index d43e33b9..464c496b 100644
--- a/src/prefs.c
+++ b/src/prefs.c
@@ -22,6 +22,7 @@
#define PREFS_NO_PROXY "localhost 127.0.0.1"
#define PREFS_SAVE_DIR "/tmp/"
#define PREFS_HTTP_REFERER "host"
+#define PREFS_HTTP_USER_AGENT "Dillo/" VERSION
/*-----------------------------------------------------------------------------
* Global Data
@@ -61,6 +62,7 @@ void a_Prefs_init(void)
prefs.http_max_conns = 6;
prefs.http_proxyuser = NULL;
prefs.http_referer = dStrdup(PREFS_HTTP_REFERER);
+ prefs.http_user_agent = dStrdup(PREFS_HTTP_USER_AGENT);
prefs.limit_text_width = FALSE;
prefs.load_images=TRUE;
prefs.load_stylesheets=TRUE;
@@ -109,6 +111,7 @@ void a_Prefs_freeall(void)
a_Url_free(prefs.http_proxy);
dFree(prefs.http_proxyuser);
dFree(prefs.http_referer);
+ dFree(prefs.http_user_agent);
dFree(prefs.no_proxy);
dFree(prefs.save_dir);
dFree(prefs.search_url);
diff --git a/src/prefs.h b/src/prefs.h
index d7421f4d..6015f2fe 100644
--- a/src/prefs.h
+++ b/src/prefs.h
@@ -38,6 +38,7 @@ struct _DilloPrefs {
DilloUrl *http_proxy;
char *http_proxyuser;
char *http_referer;
+ char *http_user_agent;
char *no_proxy;
DilloUrl *start_page;
DilloUrl *home;
diff --git a/src/prefsparser.cc b/src/prefsparser.cc
index f2cc50ac..d31c835b 100644
--- a/src/prefsparser.cc
+++ b/src/prefsparser.cc
@@ -67,6 +67,7 @@ int PrefsParser::parseOption(char *name, char *value)
{ "http_proxy", &prefs.http_proxy, PREFS_URL },
{ "http_proxyuser", &prefs.http_proxyuser, PREFS_STRING },
{ "http_referer", &prefs.http_referer, PREFS_STRING },
+ { "http_user_agent", &prefs.http_user_agent, PREFS_STRING },
{ "limit_text_width", &prefs.limit_text_width, PREFS_BOOL },
{ "load_images", &prefs.load_images, PREFS_BOOL },
{ "load_stylesheets", &prefs.load_stylesheets, PREFS_BOOL },