… | |
… | |
48 | use AnyEvent::Socket (); |
48 | use AnyEvent::Socket (); |
49 | use AnyEvent::Handle (); |
49 | use AnyEvent::Handle (); |
50 | |
50 | |
51 | use base Exporter::; |
51 | use base Exporter::; |
52 | |
52 | |
53 | our $VERSION = '1.11'; |
53 | our $VERSION = '1.12'; |
54 | |
54 | |
55 | our @EXPORT = qw(http_get http_post http_head http_request); |
55 | our @EXPORT = qw(http_get http_post http_head http_request); |
56 | |
56 | |
57 | our $USERAGENT = "Mozilla/5.0 (compatible; AnyEvent::HTTP/$VERSION; +http://software.schmorp.de/pkg/AnyEvent)"; |
57 | our $USERAGENT = "Mozilla/5.0 (compatible; AnyEvent::HTTP/$VERSION; +http://software.schmorp.de/pkg/AnyEvent)"; |
58 | our $MAX_RECURSE = 10; |
58 | our $MAX_RECURSE = 10; |
… | |
… | |
320 | } |
320 | } |
321 | |
321 | |
322 | my ($rhost, $rport, $rscheme, $rpath); # request host, port, path |
322 | my ($rhost, $rport, $rscheme, $rpath); # request host, port, path |
323 | |
323 | |
324 | if ($proxy) { |
324 | if ($proxy) { |
325 | ($rhost, $rport, $rscheme, $rpath) = (@$proxy, $url); |
325 | ($rpath, $rhost, $rport, $rscheme) = ($url, @$proxy); |
326 | |
326 | |
327 | # don't support https requests over https-proxy transport, |
327 | # don't support https requests over https-proxy transport, |
328 | # can't be done with tls as spec'ed. |
328 | # can't be done with tls as spec'ed, unless you double-encrypt. |
329 | $rscheme = "http" if $uscheme eq "https" && $rscheme eq "https"; |
329 | $rscheme = "http" if $uscheme eq "https" && $rscheme eq "https"; |
330 | } else { |
330 | } else { |
331 | ($rhost, $rport, $rscheme, $rpath) = ($uhost, $uport, $uscheme, $upath); |
331 | ($rhost, $rport, $rscheme, $rpath) = ($uhost, $uport, $uscheme, $upath); |
332 | } |
332 | } |
333 | |
333 | |