summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2011-03-21 14:19:21 -0400
committerJoey Hess <joey@kitenet.net>2011-03-21 14:19:21 -0400
commitb02d3746e1585b9cd2ce176e3e475eadf6eaa293 (patch)
tree4d2c9d6aacbb359b88cd3e32a620765cee1b1e0a /IkiWiki/Plugin
parent32200025ccdef4ff43c7bf90eeb44699844b704b (diff)
aggregate: Read cookies from ~/.ikiwiki/cookies by default. Also, the cookiejar configuration setting can be used by other plugins to provide a custom `cookie_jar` object for LWP::UserAgent. (Thanks, schmonz)
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r--IkiWiki/Plugin/aggregate.pm15
1 files changed, 14 insertions, 1 deletions
diff --git a/IkiWiki/Plugin/aggregate.pm b/IkiWiki/Plugin/aggregate.pm
index 419b40fdb..5e9673560 100644
--- a/IkiWiki/Plugin/aggregate.pm
+++ b/IkiWiki/Plugin/aggregate.pm
@@ -57,12 +57,21 @@ sub getsetup () {
safe => 1,
rebuild => 0,
},
+ cookiejar => {
+ type => "string",
+ example => { file => "$ENV{HOME}/.ikiwiki/cookies" },
+ safe => 0, # hooks into perl module internals
+ description => "cookie control",
+ },
}
sub checkconfig () {
if (! defined $config{aggregateinternal}) {
$config{aggregateinternal}=1;
}
+ if (! defined $config{cookies}) {
+ $config{cookies}={ file => "$ENV{HOME}/.ikiwiki/cookies" };
+ }
if ($config{aggregate} && ! ($config{post_commit} &&
IkiWiki::commit_hook_enabled())) {
@@ -510,7 +519,11 @@ sub aggregate (@) {
}
$feed->{feedurl}=pop @urls;
}
- my $res=URI::Fetch->fetch($feed->{feedurl});
+ my $res=URI::Fetch->fetch($feed->{feedurl},
+ UserAgent => LWP::UserAgent->new(
+ cookie_jar => $config{cookiejar},
+ ),
+ );
if (! $res) {
$feed->{message}=URI::Fetch->errstr;
$feed->{error}=1;