aboutsummaryrefslogtreecommitdiffstats
path: root/url.c
diff options
context:
space:
mode:
authorAzure <azure@fox.blue>2019-06-30 16:15:22 +0000
committerAzure <azure@fox.blue>2019-06-30 16:15:22 +0000
commit83e072d6d5b248c416f89cb144e677b2a3bdaba9 (patch)
treece5478bd6a172d5e32cc3a68e2e5a748407ff05a /url.c
parentUpdate ChangeLog (diff)
downloadw3m-83e072d6d5b248c416f89cb144e677b2a3bdaba9.tar.gz
w3m-83e072d6d5b248c416f89cb144e677b2a3bdaba9.zip
Allow setting User Agent in Siteconf
Since Google gives usable search results to Lynx but not to w3m, and many other sites block Lynx but /not/ w3m, we want to be able to set the User Agent string on a per-site basis.
Diffstat (limited to '')
-rw-r--r--url.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/url.c b/url.c
index 31d7c4b..aab7b9d 100644
--- a/url.c
+++ b/url.c
@@ -1323,10 +1323,13 @@ otherinfo(ParsedURL *target, ParsedURL *current, char *referer)
Str s = Strnew();
const int *no_referer_ptr;
int no_referer;
+ const char* url_user_agent = query_SCONF_USER_AGENT(target);
if (!override_user_agent) {
Strcat_charp(s, "User-Agent: ");
- if (UserAgent == NULL || *UserAgent == '\0')
+ if (url_user_agent)
+ Strcat_charp(s, url_user_agent);
+ else if (UserAgent == NULL || *UserAgent == '\0')
Strcat_charp(s, w3m_version);
else
Strcat_charp(s, UserAgent);