--- AnyEvent-HTTP/HTTP.pm 2010/12/31 21:00:36 1.73 +++ AnyEvent-HTTP/HTTP.pm 2011/01/01 02:20:49 1.76 @@ -610,8 +610,6 @@ return $cb->(undef, { @pseudo, Status => 599, Reason => $err }); }; - pop; # free memory, save a tree - return unless delete $state{connect_guard}; # get handle @@ -665,7 +663,7 @@ for ("$_[1]") { y/\015//d; # weed out any \015, as they show up in the weirdest of places. - /^HTTP\/([0-9\.]+) \s+ ([0-9]{3}) (?: \s+ ([^\012]*) )? \012/igxc + /^HTTP\/0*([0-9\.]+) \s+ ([0-9]{3}) (?: \s+ ([^\012]*) )? \012/gxci or return (%state = (), $cb->(undef, { @pseudo, Status => 599, Reason => "Invalid server response" })); # 100 Continue handling @@ -710,7 +708,7 @@ my $status = $hdr{Status}; # industry standard is to redirect POST as GET for - # 301, 302 and 303, in contrast to http/1.0 and 1.1. + # 301, 302 and 303, in contrast to HTTP/1.0 and 1.1. # also, the UA should ask the user for 301 and 307 and POST, # industry standard seems to be to simply follow. # we go with the industry standard. @@ -724,7 +722,7 @@ } my $finish = sub { # ($data, $err_status, $err_reason[, $keepalive]) - my $keepalive = pop; + my $may_keep_alive = $_[3]; $state{handle}->destroy if $state{handle}; %state = ();