diff options
-rw-r--r-- | IkiWiki/Plugin/aggregate.pm | 15 | ||||
-rw-r--r-- | debian/changelog | 4 | ||||
-rw-r--r-- | doc/plugins/aggregate.mdwn | 7 | ||||
-rw-r--r-- | doc/plugins/aggregate/discussion.mdwn | 2 |
4 files changed, 27 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; diff --git a/debian/changelog b/debian/changelog index a899e290d..26b80eca6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,10 @@ ikiwiki (3.20110226) UNRELEASED; urgency=low * comment: Don't show comments of subpages on parent pages. (Fixes bug introduced in version 3.20100505.) * darcs: Fix multiple issues preventing rcs_diff from working. + * 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) -- Joey Hess <joeyh@debian.org> Sun, 27 Feb 2011 18:14:05 -0400 diff --git a/doc/plugins/aggregate.mdwn b/doc/plugins/aggregate.mdwn index 2925b6fba..75123d923 100644 --- a/doc/plugins/aggregate.mdwn +++ b/doc/plugins/aggregate.mdwn @@ -48,3 +48,10 @@ plugin as well as aggregate itself, since feed entries will be stored as HTML, and as first-class wiki pages -- each one generates a separate HTML page in the output, and they can even be edited. This option is provided only for backwards compatability. + +## cookies + +The `cookiejar` option can be used to configure how [[!cpan LWP::UserAgent]] +handles cookies. The default is to read them from a file +`~/.ikiwiki/cookies`, which can be populated using standard perl cookie +tools like [[!cpan HTTP::Cookies]]. diff --git a/doc/plugins/aggregate/discussion.mdwn b/doc/plugins/aggregate/discussion.mdwn index 80788fb1b..028775ec8 100644 --- a/doc/plugins/aggregate/discussion.mdwn +++ b/doc/plugins/aggregate/discussion.mdwn @@ -133,3 +133,5 @@ the user agent to be programmatically manipulated? --[[schmonz]] >>> `$config{cookies}` (and using it in the aggregate plugin) should >>> be safe, might help people in typical cases, and won't prevent >>> further enhancements for less typical cases. --[[schmonz]] + +>>>> Ok, done. Called it cookiejar. --[[Joey]] |