aboutsummaryrefslogtreecommitdiffstats
path: root/rc.c
diff options
context:
space:
mode:
authorTatsuya Kinoshita <tats@debian.org>2019-07-01 13:58:33 +0000
committerGitHub <noreply@github.com>2019-07-01 13:58:33 +0000
commitd6545481aeb15b71f44f4a3b903fbd38703425de (patch)
treece5478bd6a172d5e32cc3a68e2e5a748407ff05a /rc.c
parentUpdate ChangeLog (diff)
parentAllow setting User Agent in Siteconf (diff)
downloadw3m-d6545481aeb15b71f44f4a3b903fbd38703425de.tar.gz
w3m-d6545481aeb15b71f44f4a3b903fbd38703425de.zip
Merge pull request #119 from adamemerson/siteconf-user-agent
Allow setting User Agent in Siteconf
Diffstat (limited to 'rc.c')
-rw-r--r--rc.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/rc.c b/rc.c
index 3fd84ef..25f7a56 100644
--- a/rc.c
+++ b/rc.c
@@ -1602,6 +1602,7 @@ helpFile(char *base)
* url_charset <charset>
* no_referer_from on|off
* no_referer_to on|off
+ * user_agent "<string>"
*
* The last match wins.
*/
@@ -1614,6 +1615,7 @@ struct siteconf_rec {
unsigned char mask[(SCONF_N_FIELD + 7) >> 3];
char *substitute_url;
+ char *user_agent;
#ifdef USE_M17N
wc_ces url_charset;
#endif
@@ -1640,6 +1642,7 @@ newSiteconfRec(void)
memset(ent->mask, 0, sizeof(ent->mask));
ent->substitute_url = NULL;
+ ent->user_agent = NULL;
#ifdef USE_M17N
ent->url_charset = 0;
#endif
@@ -1718,6 +1721,10 @@ loadSiteconf(void)
ent->substitute_url = getQWord(&p);
SCONF_SET(ent, SCONF_SUBSTITUTE_URL);
}
+ if (strcmp(s, "user_agent") == 0) {
+ ent->user_agent = getQWord(&p);
+ SCONF_SET(ent, SCONF_USER_AGENT);
+ }
#ifdef USE_M17N
else if (strcmp(s, "url_charset") == 0) {
char *charset = getWord(&p);
@@ -1797,6 +1804,11 @@ url_found:
return tmp->ptr;
}
return NULL;
+ case SCONF_USER_AGENT:
+ if (ent->user_agent && *ent->user_agent) {
+ return ent->user_agent;
+ }
+ return NULL;
#ifdef USE_M17N
case SCONF_URL_CHARSET:
return &ent->url_charset;