diff options
author | intrigeri <intrigeri@boum.org> | 2010-12-20 14:27:21 +0100 |
---|---|---|
committer | intrigeri <intrigeri@boum.org> | 2010-12-20 14:27:21 +0100 |
commit | 75196e76b627709a6ecae3fa948e1fba7928a5ce (patch) | |
tree | 6aa2baeb9cc68f98ca256ce0ff5cb20909f52ef9 /doc/plugins/aggregate/discussion.mdwn | |
parent | 8c2962ec48ae57605d6d0e297be437a97b6229ca (diff) | |
parent | e5ed3c9e3801360cc00ce4f4f325f68ac0770bff (diff) |
Merge remote branch 'upstream/master' into prv/po
Diffstat (limited to 'doc/plugins/aggregate/discussion.mdwn')
-rw-r--r-- | doc/plugins/aggregate/discussion.mdwn | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/doc/plugins/aggregate/discussion.mdwn b/doc/plugins/aggregate/discussion.mdwn index 1a9844577..a3336ee08 100644 --- a/doc/plugins/aggregate/discussion.mdwn +++ b/doc/plugins/aggregate/discussion.mdwn @@ -89,3 +89,35 @@ New bug: new posts aren't getting displayed (or cached for aggregation). After f >>> mind having a copy to investigate. --[[Joey]] >>>> Didn't think of that, will keep a copy if there's a next time. -- [[schmonz]] + +----- + +In a corporate environment where feeds are generally behind +authentication, I need to prime the aggregator's `LWP::UserAgent` +with some cookies. What I've done is write a custom plugin to populate +`$config{cookies}` with an `HTTP::Cookies` object, plus this diff: + + --- /var/tmp/pkg/lib/perl5/vendor_perl/5.10.0/IkiWiki/Plugin/aggregate.pm 2010-06-24 13:03:33.000000000 -0400 + +++ aggregate.pm 2010-06-24 13:04:09.000000000 -0400 + @@ -488,7 +488,11 @@ + } + $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{cookies}, + + ), + + ); + if (! $res) { + $feed->{message}=URI::Fetch->errstr; + $feed->{error}=1; + +It works, but I have to remember to apply the diff whenever I update +ikiwiki. Can you provide a more elegant means of allowing cookies and/or +the user agent to be programmatically manipulated? --[[schmonz]] + +> Ping -- is the above patch perhaps acceptable (or near-acceptable)? -- [[schmonz]] + +>> Pong.. I'd be happier with a more 100% solution that let cookies be used +>> w/o needing to write a custom plugin to do it. --[[Joey]] |