in reply to Re: LWP::UserAgent Wrongly Uses HTTP/1.1
in thread LWP::UserAgent Wrongly Uses HTTP/1.1

See this - I did this manually on one of our test servers:
GET / HTTP/1.0 HTTP/1.1 400 Bad Request Date: Thu, 20 Nov 2003 09:30:34 GMT Server: Apache/1.3.26 (Unix) mod_gzip/1.3.19.1a Connection: close Content-Type: text/html; charset=iso-8859-1
The request was input manually. The request is HTTP 1.0, but Apache returns HTTP/1.1. The same behaviour was shown by IIS on another machine we have here.

Replies are listed 'Best First'.
Re: I think Liz is right
by davis (Vicar) on Nov 20, 2003 at 09:52 UTC

    I tried doing the same, and Apache does return an HTTP/1.1 response. However, when I do the manual request, the webserver log shows the request was HTTP/1.0 — whereas the LWP::UserAgent method gets logged as an HTTP/1.1 request.
    The challenge therefore appears to be getting the LWP::UserAgent script to emit a request that gets logged as HTTP/1.0.


    davis
    It's not easy to juggle a pregnant wife and a troubled child, but somehow I managed to fit in eight hours of TV a day.
      Don't know if this is helpful, but RFC 2616 saith:
      Due to interoperability problems with HTTP/1.0 proxies discovered since the publication of RFC 2068, caching proxies MUST, gateways MAY, and tunnels MUST NOT upgrade the request to the highest version they support. The proxy/gateway's response to that request MUST be in the same major version as the request.
      Also, RFC 2145 clarifies that the minor version the client sends has no relation to the version the server returns. Each should normally send the highest version for which it is at least conditionally compliant.
Server always returns what it can do
by liz (Monsignor) on Nov 20, 2003 at 10:15 UTC
    And if you give it a higher version:
    GET / HTTP/1.2 HTTP/1.1 200 OK Date: Thu, 20 Nov 2003 10:13:20 GMT
    it still gives you back what the server is capable of doing. Mind you, in this case, the connection was kept alive (because it was handled as an 1.1 request, I would assume). This doesn't happen if I specify 1.0 in the request.

    Liz

Re: I think Liz is right
by Anonymous Monk on Nov 20, 2003 at 11:11 UTC
    Could you explain what you mean by "input manually"? I'm not sure how you did this.
      You're simulating a browser by typing in the right commands of the HTTP protocol at the right time. You need a telnet client program for that. On *nix, this would be (IP-numbers and host names simulated):
      $ telnet your.server.com 80 (enter) Trying 1.2.3.4... Connected to your.server.com. Escape character is '^]'. GET / HTTP/1.0 (enter) Host: www.yourhost.com (enter) (enter) HTTP/1.1 200 OK Date: Thu, 20 Nov 2003 11:21:23 GMT (etc.) $
      Note that the (enter) indicates where you press ENTER.

      Hope this helps.

      Liz

      Telnet to the webserver on port 80