--- AnyEvent-HTTP/HTTP.pm 2015/05/08 17:28:39 1.122 +++ AnyEvent-HTTP/HTTP.pm 2016/01/07 13:14:16 1.126 @@ -48,7 +48,7 @@ use base Exporter::; -our $VERSION = 2.21; +our $VERSION = 2.22; our @EXPORT = qw(http_get http_post http_head http_request); @@ -197,6 +197,9 @@ If not specified, then the default proxy is used (see C). +Currently, if your proxy requires authorization, you have to specify an +appropriate "Proxy-Authorization" header in every request. + =item body => $string The request body, usually empty. Will be sent as-is (future versions of @@ -772,7 +775,7 @@ : $uscheme eq "https" ? 443 : return $cb->(undef, { @pseudo, Status => 599, Reason => "Only http and https URL schemes supported" }); - $uauthority =~ /^(?: .*\@ )? ([^\@:]+) (?: : (\d+) )?$/x + $uauthority =~ /^(?: .*\@ )? ([^\@]+?) (?: : (\d+) )?$/x or return $cb->(undef, { @pseudo, Status => 599, Reason => "Unparsable URL" }); my $uhost = lc $1; @@ -894,7 +897,7 @@ my $loc = $hdr{location}; if ($loc =~ m%^//%) { # // - $loc = "$rscheme:$loc"; + $loc = "$uscheme:$loc"; } elsif ($loc eq "") { $loc = $url; @@ -903,7 +906,7 @@ $loc =~ s/^\.\/+//; if ($loc !~ m%^[.?#]%) { - my $prefix = "$rscheme://$uhost:$uport"; + my $prefix = "$uscheme://$uhost:$uport"; unless ($loc =~ s/^\///) { $prefix .= $upath; @@ -1122,10 +1125,10 @@ %state = (); $state{recurse} = http_request ( - $method => $url, + $method => $url, %arg, - recurse => $recurse - 1, - keepalive => 0, + recurse => $recurse - 1, + persistent => 0, sub { %state = (); &$cb