develooper Front page | perl.libwww | Postings from December 2012

Client-Warning header does not work as expected when max redirectsset to 0

From:
Victor Efimov
Date:
December 8, 2012 20:17
Subject:
Client-Warning header does not work as expected when max redirectsset to 0
Message ID:
CAF7QZD7mDJ+on4EiNiVThXLVJ+=GAoN_3EuCWYaisGxzgGo=qA@mail.gmail.com
Hello.

A small bug report from me. I have actually 3. here is 1st one.
(I am not sure where to send bug reports, as there is 3 places with
libwww-perl issue lists)

In the docs for LWP::UserAgent there is:

> There will still be a response object returned when LWP can't connect to the server specified in the URL or when other failures in protocol handlers occur. These internal responses use the standard HTTP status codes, so the responses can't be differentiated by testing the response status code alone. Error responses that LWP generates internally will have the "Client-Warning" header set to the value "Internal response". If you need to differentiate these internal responses from responses that a remote server actually generates, you need to test this header value.



However this does not work when you set max_redirects to 0.

I am getting the following:

> 500 Can't connect to 1.2.3.4:443 (Connection timed out)
> Content-Type: text/plain
> Client-Date: Sat, 03 Nov 2012 14:32:56 GMT
> Client-Warning: Redirect loop detected (max_redirect = 0)


(Client-Warning overwrited with another message about redirect loop)

so I think this should be noticed in documentation, at least.



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About