in reply to Re: LWP::UserAgent non-feature? (docs)
in thread LWP::UserAgent non-feature?

Thanks for the replies folks. At this juncture, I should make a few brief points, and then just leave this "non-feature" be.

1) After posting last nite, I traced the problem I was having with the server sending back "incorrect" results to my own programatic faux pas. My original test code (which I did not post) inadvertantly was lower casing the entire URL inappropriately, and that was the real problem. Once fixed, everything else worked beautifully. I am suitably humble that my own mistake was the primary cause of my posting here.

2) Regardless of the above, the output generated by the as_string method of HTTP::Request is inherently prone to causing confusion, I think, given that the string generated by that method is not, apparently, what actually gets sent to the server in at least some cases.

3) There is no compelling reason that I can see why the request method of LWP::UserAgent either cannot be or should not be smart enough and/or helpful enough to be able to obtain the server hostname from a Host: header which is present within the HTTP::Request object it is given. But it does appear to be the case that it does not do so, preferring instead to yield a simulated 400 error response from the actual server, which is itself arguably problematic, i.e. in that this faked server response might cause... and apparently has caused... some users to believe that this response is actually coming from the real server. (Wouldn't it perhaps be better to throw an exception, or some such other thing, rather than internally generating a confusing faked server response?)

Replies are listed 'Best First'.
Re^3: LWP::UserAgent non-feature? (docs)
by Anonymous Monk on Jan 13, 2015 at 23:39 UTC
    Hmm, whenever LWP "fakes" a response, it identifies it as such "Client-Warning" header set to the value "Internal response".