]> sipb.mit.edu Git - ikiwiki.git/commitdiff
Merge remote-tracking branch 'schmonz/proxy'
authorJoey Hess <joey@kitenet.net>
Sat, 3 Aug 2013 14:03:31 +0000 (10:03 -0400)
committerJoey Hess <joey@kitenet.net>
Sat, 3 Aug 2013 14:03:31 +0000 (10:03 -0400)
Conflicts:
doc/todo/outbound_proxy.mdwn
doc/users/schmonz.mdwn

IkiWiki.pm
IkiWiki/Plugin/aggregate.pm
IkiWiki/Plugin/openid.pm
IkiWiki/Plugin/pinger.pm
doc/users/schmonz.mdwn

index c497dd38f5b160af6c536dc9038bf31da585debb..75c95793218384bd034914d574e63464f739fd31 100644 (file)
@@ -22,7 +22,7 @@ our @EXPORT = qw(hook debug error htmlpage template template_depends
        htmllink readfile writefile pagetype srcfile pagename
        displaytime strftime_utf8 will_render gettext ngettext urlto targetpage
        add_underlay pagetitle titlepage linkpage newpagefile
-       inject add_link add_autofile
+       inject add_link add_autofile useragent
        %config %links %pagestate %wikistate %renderedfiles
        %pagesources %destsources %typedlinks);
 our $VERSION = 3.00; # plugin interface version, next is ikiwiki version
@@ -513,6 +513,14 @@ sub getsetup () {
                safe => 0,
                rebuild => 0,
        },
+       cookiejar => {
+               type => "string",
+               default => "$ENV{HOME}/.ikiwiki/cookies",
+               description => "cookie control",
+               example => { file => "$ENV{HOME}/.ikiwiki/cookies" },
+               safe => 0, # hooks into perl module internals
+               rebuild => 0,
+       },
 }
 
 sub defaultconfig () {
@@ -2274,6 +2282,13 @@ sub add_autofile ($$$) {
        $autofiles{$file}{generator}=$generator;
 }
 
+sub useragent () {
+       return LWP::UserAgent->new(
+               cookie_jar => $config{cookiejar},
+               env_proxy => 1,         # respect proxy env vars
+       );
+}
+
 sub sortspec_translate ($$) {
        my $spec = shift;
        my $reverse = shift;
index be6e8d47677506d254990c1385f314a9731583c3..3e3eb6d9301da377b6a72128cde42f25a41da34c 100644 (file)
@@ -58,21 +58,12 @@ 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{cookiejar}) {
-               $config{cookiejar}={ file => "$ENV{HOME}/.ikiwiki/cookies" };
-       }
 
        # This is done here rather than in a refresh hook because it
        # needs to run before the wiki is locked.
@@ -522,11 +513,8 @@ sub aggregate (@) {
                        }
                        $feed->{feedurl}=pop @urls;
                }
-               my $res=URI::Fetch->fetch($feed->{feedurl},
-                       UserAgent => LWP::UserAgent->new(
-                               cookie_jar => $config{cookiejar},
-                       ),
-               );
+               my $ua=useragent();
+               my $res=URI::Fetch->fetch($feed->{feedurl}, UserAgent=>$ua);
                if (! $res) {
                        $feed->{message}=URI::Fetch->errstr;
                        $feed->{error}=1;
index e3b9982f2d3bbf4d5185ae7a1b97c850f6cdaa89..d369e30c995277f8a5e7f5bccdd5cd17dbcea0aa 100644 (file)
@@ -241,7 +241,7 @@ sub getobj ($$) {
                $ua=LWPx::ParanoidAgent->new;
        }
        else {
-               $ua=LWP::UserAgent->new;
+               $ua=useragent();
        }
 
        # Store the secret in the session.
index 588f7a42a4698f6ce72e24b4647df2bedc862c7a..fb0f3ba0aa9cf9676f95eaded1f4569504015c99 100644 (file)
@@ -80,7 +80,7 @@ sub ping {
                                debug(gettext("LWP not found, not pinging"));
                                return;
                        }
-                       $ua=LWP::UserAgent->new;
+                       $ua=useragent();
                }
                $ua->timeout($config{pinger_timeout} || 15);
                
index 1f80cb05ef891c68346e64b7064914b975033178..2e6bfb331263fed708469958a208e3c5f755eecc 100644 (file)
@@ -21,7 +21,7 @@ pages="!*/Discussion and ((link(users/schmonz) and plugins/*) or rcs/cvs or todo
 * At work, team documentation and project planning: product and sprint
   backlogs, burndown charts, release plans/procedures/announcements,
   aggregating feeds of shared interest, etc. (with the [[todo/outbound_proxy]]
-  patch)
+  patch and [[plugins/contrib/dynamiccookies]] plugin)
 * On my laptop, personal to-do and scratch space
 * [A small personal site](http://podcast.schmonz.com/) (happily hosted at
   [Branchable](http://www.branchable.com/))