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

Is the request 1.1 also? Or is that still 1.0?

If I remember correctly, an HTTP server indicates back to the requestor what it is capable of handling. So, if you do a 1.0 request to a server, and the server replies with 1.1, that only means that the server can do 1.1 requests, not that the server actually handled it as a 1.1 request.

Is that what is going on?

Liz

  • Comment on Re: LWP::UserAgent Wrongly Uses HTTP/1.1

Replies are listed 'Best First'.
I think Liz is right
by l3nz (Friar) on Nov 20, 2003 at 09:33 UTC
    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.

      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.
      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

      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
Re: Re: LWP::UserAgent Wrongly Uses HTTP/1.1
by Anonymous Monk on Nov 20, 2003 at 11:08 UTC
    When I look at the packet sniffer, both the request and the reply are 1.0.
      Correction: I meant to say that the sniffer shows both the request and reply as 1.1 when I use LWP, but using telnet I can get the request to be 1.0.
      Then I can only assume that LWP::UserAgent is doing some magic below the surface.

      Liz