Mercurial > dillo_port1.3
changeset 1560:c47ab3201464
add http_user_agent preference
thread: http://lists.auriga.wearlab.de/pipermail/dillo-dev/2010-February/007267.html
author | Alexander Voigt, corvid |
---|---|
date | Thu, 11 Feb 2010 22:17:57 +0000 |
parents | 3bafb7d27d78 |
children | cddefa34b7ec |
files | ChangeLog dillorc src/IO/http.c src/prefs.c src/prefs.h src/prefsparser.cc |
diffstat | 6 files changed, 27 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Thu Feb 11 20:11:03 2010 +0000 +++ b/ChangeLog Thu Feb 11 22:17:57 2010 +0000 @@ -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.
--- a/dillorc Thu Feb 11 20:11:03 2010 +0000 +++ b/dillorc Thu Feb 11 22:17:57 2010 +0000 @@ -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
--- a/src/IO/http.c Thu Feb 11 20:11:03 2010 +0000 +++ b/src/IO/http.c Thu Feb 11 22:17:57 2010 +0000 @@ -312,13 +312,13 @@ "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 @@ "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);
--- a/src/prefs.c Thu Feb 11 20:11:03 2010 +0000 +++ b/src/prefs.c Thu Feb 11 22:17:57 2010 +0000 @@ -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 @@ 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 @@ 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);
--- a/src/prefs.h Thu Feb 11 20:11:03 2010 +0000 +++ b/src/prefs.h Thu Feb 11 22:17:57 2010 +0000 @@ -38,6 +38,7 @@ DilloUrl *http_proxy; char *http_proxyuser; char *http_referer; + char *http_user_agent; char *no_proxy; DilloUrl *start_page; DilloUrl *home;
--- a/src/prefsparser.cc Thu Feb 11 20:11:03 2010 +0000 +++ b/src/prefsparser.cc Thu Feb 11 22:17:57 2010 +0000 @@ -67,6 +67,7 @@ { "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 },