]> sipb.mit.edu Git - ikiwiki.git/blobdiff - doc/plugins/aggregate/discussion.mdwn
Merge branch 'master' of ssh://git.ikiwiki.info/srv/git/ikiwiki.info
[ikiwiki.git] / doc / plugins / aggregate / discussion.mdwn
index 768a9f5577e04c72972e1a5074e9c45792b2016c..80788fb1b334cffa1951584efcd44d4248575bc9 100644 (file)
@@ -35,7 +35,7 @@ Two things aren't working as I'd expect:
 > problem. You can see the feed validator complain about it here:
 > <http://feedvalidator.org/check.cgi?url=http%3A%2F%2Fwww.davidj.org%2Frss.xml>
 > 
-> It's sorta unfortunate that [[cpan XML::Feed]] doesn't just assume the
+> It's sorta unfortunate that [[!cpan XML::Feed]] doesn't just assume the
 > un-esxaped html is part of the description field. Probably other feed
 > parsers are more lenient. --[[Joey]]
 
@@ -84,3 +84,52 @@ New bug: new posts aren't getting displayed (or cached for aggregation). After f
 > reproduced your ikiwiki's state. --[[Joey]]
 
 >> Okay, I blew away the cached entries and aggregator state files and reran the aggregator and all appears well again. If the problem recurs I'll be sure to post here. :-) --[[schmonz]]
+
+>>> On the off chance that you retained a copy of the old state, I'd not
+>>> 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]] 
+
+>>> According to LWP::UserAgent, for the common case, a complete
+>>> and valid configuration for `$config{cookies}` would be `{ file =>
+>>> "$ENV{HOME}/.cookies.txt" }`. In the more common case of not needing
+>>> to prime one's cookies, `cookie_jar` can be `undef` (that's the
+>>> default). In my less common case, the cookies are generated by
+>>> visiting a couple magic URLs, which would be trivial to turn into
+>>> config options, except that these particular URLs rely on SPNEGO
+>>> and so LWP::Authen::Negotiate has to be loaded. So I think adding
+>>> `$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]]