… | |
… | |
661 | # status line and headers |
661 | # status line and headers |
662 | $state{read_response} = sub { |
662 | $state{read_response} = sub { |
663 | for ("$_[1]") { |
663 | for ("$_[1]") { |
664 | y/\015//d; # weed out any \015, as they show up in the weirdest of places. |
664 | y/\015//d; # weed out any \015, as they show up in the weirdest of places. |
665 | |
665 | |
666 | /^HTTP\/([0-9\.]+) \s+ ([0-9]{3}) (?: \s+ ([^\012]*) )? \012/igxc |
666 | /^HTTP\/0*([0-9\.]+) \s+ ([0-9]{3}) (?: \s+ ([^\012]*) )? \012/gxci |
667 | or return (%state = (), $cb->(undef, { @pseudo, Status => 599, Reason => "Invalid server response" })); |
667 | or return (%state = (), $cb->(undef, { @pseudo, Status => 599, Reason => "Invalid server response" })); |
668 | |
668 | |
669 | # 100 Continue handling |
669 | # 100 Continue handling |
670 | # should not happen as we don't send expect: 100-continue, |
670 | # should not happen as we don't send expect: 100-continue, |
671 | # but we handle it just in case. |
671 | # but we handle it just in case. |
… | |
… | |
706 | |
706 | |
707 | if ($recurse) { |
707 | if ($recurse) { |
708 | my $status = $hdr{Status}; |
708 | my $status = $hdr{Status}; |
709 | |
709 | |
710 | # industry standard is to redirect POST as GET for |
710 | # industry standard is to redirect POST as GET for |
711 | # 301, 302 and 303, in contrast to http/1.0 and 1.1. |
711 | # 301, 302 and 303, in contrast to HTTP/1.0 and 1.1. |
712 | # also, the UA should ask the user for 301 and 307 and POST, |
712 | # also, the UA should ask the user for 301 and 307 and POST, |
713 | # industry standard seems to be to simply follow. |
713 | # industry standard seems to be to simply follow. |
714 | # we go with the industry standard. |
714 | # we go with the industry standard. |
715 | if ($status == 301 or $status == 302 or $status == 303) { |
715 | if ($status == 301 or $status == 302 or $status == 303) { |
716 | # HTTP/1.1 is unclear on how to mutate the method |
716 | # HTTP/1.1 is unclear on how to mutate the method |