aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki.pm
diff options
context:
space:
mode:
authorTuomas Jormola <tj@solitudo.net>2014-01-30 14:41:55 +0200
committerJoey Hess <joey@kitenet.net>2014-02-01 16:53:33 -0400
commitdc53ca18f2bbbfe93be2786680f3afe1bd24afea (patch)
tree0e331e14820a64b0d95ed9c751e1c6b7031fbb99 /IkiWiki.pm
parent79e40f031811c38ed9eb6e3c17dfded63310b5eb (diff)
downloadikiwiki-dc53ca18f2bbbfe93be2786680f3afe1bd24afea.tar
ikiwiki-dc53ca18f2bbbfe93be2786680f3afe1bd24afea.tar.gz
Bug#737121: ikiwiki: [PATCH] Implement configuration option to set the user agent string for outbound HTTP requests
Package: ikiwiki Version: 3.20140125 Severity: wishlist By default, LWP::UserAgent used by IkiWiki to perform outbound HTTP requests sends the string "libwww-perl/<version number>" as User-Agent header in HTTP requests. Some blogging platforms have blacklisted the user agent and won't serve any content for clients using this user agent string. With IkiWiki configuration option "useragent" it's now possible to define a custom string that is used for the value of the User-Agent header.
Diffstat (limited to 'IkiWiki.pm')
-rw-r--r--IkiWiki.pm9
1 files changed, 9 insertions, 0 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm
index b7080bb0b..eb480969b 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -527,6 +527,14 @@ sub getsetup () {
safe => 0, # hooks into perl module internals
rebuild => 0,
},
+ useragent => {
+ type => "string",
+ default => undef,
+ example => "Wget/1.13.4 (linux-gnu)",
+ description => "set custom user agent string for outbound HTTP requests e.g. when fetching aggregated RSS feeds",
+ safe => 0,
+ rebuild => 0,
+ },
}
sub defaultconfig () {
@@ -2301,6 +2309,7 @@ sub useragent () {
return LWP::UserAgent->new(
cookie_jar => $config{cookiejar},
env_proxy => 1, # respect proxy env vars
+ agent => $config{useragent},
);
}