]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
Honor proxy env vars and reliably honor cookiejar.
authorAmitai Schlair <schmonz-web-ikiwiki@schmonz.com>
Sat, 27 Jul 2013 12:12:01 +0000 (08:12 -0400)
committerAmitai Schlair <schmonz-web-ikiwiki@schmonz.com>
Sat, 27 Jul 2013 12:12:01 +0000 (08:12 -0400)
IkiWiki.pm
IkiWiki/Plugin/aggregate.pm
IkiWiki/Plugin/openid.pm
IkiWiki/Plugin/pinger.pm

index c497dd38f5b160af6c536dc9038bf31da585debb..3fc0c7d8a5a2fc01f39259c16d73a034e8657305 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
        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
        %config %links %pagestate %wikistate %renderedfiles
        %pagesources %destsources %typedlinks);
 our $VERSION = 3.00; # plugin interface version, next is ikiwiki version
@@ -2274,6 +2274,13 @@ sub add_autofile ($$$) {
        $autofiles{$file}{generator}=$generator;
 }
 
        $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;
 sub sortspec_translate ($$) {
        my $spec = shift;
        my $reverse = shift;
index be6e8d47677506d254990c1385f314a9731583c3..ccbc6c9a9b9565640f9a70c3f089102418f8910e 100644 (file)
@@ -522,11 +522,8 @@ sub aggregate (@) {
                        }
                        $feed->{feedurl}=pop @urls;
                }
                        }
                        $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;
                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=LWPx::ParanoidAgent->new;
        }
        else {
-               $ua=LWP::UserAgent->new;
+               $ua=useragent();
        }
 
        # Store the secret in the session.
        }
 
        # 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;
                        }
                                debug(gettext("LWP not found, not pinging"));
                                return;
                        }
-                       $ua=LWP::UserAgent->new;
+                       $ua=useragent();
                }
                $ua->timeout($config{pinger_timeout} || 15);
                
                }
                $ua->timeout($config{pinger_timeout} || 15);