--- AnyEvent-HTTP/HTTP.pm 2008/11/21 06:56:05 1.36 +++ AnyEvent-HTTP/HTTP.pm 2009/03/07 03:43:09 1.38 @@ -50,7 +50,7 @@ use base Exporter::; -our $VERSION = '1.1'; +our $VERSION = '1.11'; our @EXPORT = qw(http_get http_post http_head http_request); @@ -322,10 +322,10 @@ my ($rhost, $rport, $rscheme, $rpath); # request host, port, path if ($proxy) { - ($rhost, $rport, $rscheme, $rpath) = (@$proxy, $url); + ($rpath, $rhost, $rport, $rscheme) = ($url, @$proxy); # don't support https requests over https-proxy transport, - # can't be done with tls as spec'ed. + # can't be done with tls as spec'ed, unless you double-encrypt. $rscheme = "http" if $uscheme eq "https" && $rscheme eq "https"; } else { ($rhost, $rport, $rscheme, $rpath) = ($uhost, $uport, $uscheme, $upath); @@ -527,7 +527,9 @@ # too bad, need to read until we get an error or EOF, # no way to detect winged data. $_[0]->on_error (sub { - $finish->($_[0]{rbuf}, \%hdr); + # delete ought to be more efficient, as we would have to make + # a copy otherwise as $_[0] gets destroyed. + $finish->(delete $_[0]{rbuf}, \%hdr); }); $_[0]->on_eof (undef); $_[0]->on_read (sub { });