[PATCH] dealing with mutiple HTTP 100 Continue responses

[PATCH] dealing with mutiple HTTP 100 Continue responses

am 14.10.2004 18:22:18 von tom.yandell

--Boundary-00=_6eqbBkZw5hRkRGG
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset="us-ascii"
Content-Disposition: inline

I have had a problem with sending a request with LWP::UserAgent to a server
that returns multiple 100 Continue responses after the request has been
written. The server responds with:

HTTP/1.1 100 Continue

HTTP/1.1 100 Continue

HTTP/1.1 100 Continue

HTTP/1.1 200 OK
....

This works okay when I do it over telnet, but with LWP::UserAgent it doesn't.
It seems to handle multiple 100 Continue responses while it is writing data,
but after will only accept one. I have attached a patch to the file
lib/LWP/Protocol/http.pm that seems to fix the problem.

Regards,
Thomas Yandell


--Boundary-00=_6eqbBkZw5hRkRGG
Content-Transfer-Encoding: 7bit
Content-Type: text/x-diff;
charset="us-ascii";
name="lwp.patch"
Content-Disposition: attachment;
filename="lwp.patch"

--- lib/LWP/Protocol/http.pm~ 2004-06-14 18:40:40.000000000 +0100
+++ lib/LWP/Protocol/http.pm 2004-10-14 17:11:02.979140012 +0100
@@ -305,7 +305,7 @@
($code, $mess, @h) = $socket->read_response_headers(laxed => 1, junk_out => \@junk)
unless $code;
($code, $mess, @h) = $socket->read_response_headers(laxed => 1, junk_out => \@junk)
- if $code eq "100";
+ while $code eq "100";

my $response = HTTP::Response->new($code, $mess);
my $peer_http_version = $socket->peer_http_version;

--Boundary-00=_6eqbBkZw5hRkRGG--