in reply to Re: Direct a LWP connection to a different host
in thread Direct a LWP connection to a different host

How can that work? HTTP requests sent to proxies differ from those sent to destination hosts.

Makeshifts last the longest.

  • Comment on Re^2: Direct a LWP connection to a different host

Replies are listed 'Best First'.
Re^3: Direct a LWP connection to a different host
by Corion (Patriarch) on Jan 31, 2005 at 07:45 UTC

    This should work too, at least somewhat, because the main difference between the proxy request and the real request is that the GET request is changed from a relative to an absolute URL:

    Host: www.google.com GET http://www.google.com/

    instead of

    Host: www.google.com GET /

    But yes, that somewhat invalidates the intent to just redirect the socket connection and leave everything else as-is, to fake a different name resolution as there actually is.

      Yes, and I expected servers would return a 5XX response in such cases, It seems that instead, those I tried this with treat a request of this form as a request for the server root. So in a roundabout way it accidentally works as intended for (some of) the uses discussed in the root node. Strange.

      Makeshifts last the longest.

        Good point, this may not work with every HTTP server out there.

        all of the servers i've ever seen (that understand HTTP/1.1) use the Host header to determine the virtual host, and ignore the hostname from the request line. but there is no garuntee that that's tru for *ALL* HTTP servers.