--- AnyEvent-HTTP/HTTP.pm 2011/01/02 05:13:27 1.84 +++ AnyEvent-HTTP/HTTP.pm 2011/01/02 08:51:53 1.87 @@ -38,8 +38,7 @@ package AnyEvent::HTTP; -use strict; -no warnings; +use common::sense; use Errno (); @@ -418,8 +417,6 @@ sub cookie_jar_extract($$$$) { my ($jar, $uscheme, $uhost, $upath) = @_; - $uhost = lc $uhost; - %$jar = () if $jar->{version} != 1; my @cookies; @@ -611,7 +608,7 @@ $uauthority =~ /^(?: .*\@ )? ([^\@:]+) (?: : (\d+) )?$/x or return $cb->(undef, { @pseudo, Status => 599, Reason => "Unparsable URL" }); - my $uhost = $1; + my $uhost = lc $1; $uport = $2 if defined $2; $hdr{host} = defined $2 ? "$uhost:$2" : "$uhost" @@ -640,6 +637,9 @@ # don't support https requests over https-proxy transport, # can't be done with tls as spec'ed, unless you double-encrypt. $rscheme = "http" if $uscheme eq "https" && $rscheme eq "https"; + + $rhost = lc $rhost; + $rscheme = lc $rscheme; } else { ($rhost, $rport, $rscheme, $rpath) = ($uhost, $uport, $uscheme, $upath); } @@ -651,7 +651,7 @@ $hdr{"content-length"} = length $arg{body} if length $arg{body} || $method ne "GET"; - $hdr{connection} = "close TE"; #1.1 + $hdr{connection} = "close Te"; #1.1 $hdr{te} = "trailers" unless exists $hdr{te}; #1.1 my %state = (connect_guard => 1); @@ -779,7 +779,6 @@ $ae_error = 597; # body phase my $len = $hdr{"content-length"}; - warn "no content $redirect x<$len>$hdr{Status}\n";#d# # body handling, many different code paths # - no body expected @@ -936,7 +935,7 @@ # oh dear, we have to wrap it into a connect request # maybe re-use $uauthority with patched port? - $state{handle}->push_write ("CONNECT $uhost:$uport HTTP/1.0\015\012Host: $uhost\015\012\015\012"); + $state{handle}->push_write ("CONNECT $uhost:$uport HTTP/1.0\015\012\015\012"); $state{handle}->push_read (line => $qr_nlnl, sub { $_[1] =~ /^HTTP\/([0-9\.]+) \s+ ([0-9]{3}) (?: \s+ ([^\015\012]*) )?/ix or return (%state = (), $cb->(undef, { @pseudo, Status => 599, Reason => "Invalid proxy connect response ($_[1])" }));