.
Really Weird Shit - Grin with cat attached
Previous Entry Next Entry
Really Weird Shit Feb. 8th, 2006 01:22 pm
telnet www.phase.org 80
GET /

- this works from our dev box (default page of course).



telnet www.phase.org 80
GET / HTTP/1.1
Host: www.phase.org

- this does not work from our dev box (connection returns no data and times out). Works from my office desktop & home server though...
Lynx works on the dev box, php's file_get_contents() doesn't.


ETA:
telnet www.phase.org 80
GET http://www.phase.org/

works, and

telnet www.phase.org 80
GET http://www.phase.org/ HTTP/1.1

returns as "Invalid request"
Any ideas?

From: ciphergoth
Date: February 8th, 2006 - 01:36 pm (Link)
There's a transparent proxy between you and phase.org?

If you have a spare IP address, try setting up something on port 80 that just prints "hello there" when you connect to it, and try connecting from two different places?
From: bondagewoodelf
Date: February 8th, 2006 - 03:23 pm (Link)
For HTTP/1.1 use:

GET / HTTP/1.1
Host: www.phase.org

For HTTP/1.0 use:

GET http://www.phase.org/ HTTP/1.0

AFAIK in HTTP 1.1 absolute URLs are not allowed in requests, the hostname must be specified as a Host: header. If your server allows absolute URLs with HTTP 1.1, it is not conforming to standards.
From: wechsler
Date: February 8th, 2006 - 03:38 pm (Link)
Yeah, the first one is what I'm doing and fails... making web unit testing tricky at best.
From: mooism
Date: February 8th, 2006 - 03:42 pm (Link)
Absolute URLs are used in requests to proxies. Also, HTTP/1.1 origin servers are required to accept absolute URLs even though clients aren’t allowed to generate them.
From: bondagewoodelf
Date: February 8th, 2006 - 04:03 pm (Link)
Also, HTTP/1.1 origin servers are required to accept absolute URLs even though clients aren’t allowed to generate them.

However, even if the URL given is absolute, the Host: header is mandatory for such URLs:

telnet localhost 80
Trying 127.0.0.1...
Connected to spongebob-squarepants.
Escape character is '^]'.
HEAD http://localhost/ HTTP/1.1

HTTP/1.1 400 Bad Request
Date: Wed, 08 Feb 2006 16:05:43 GMT
Server: Apache/1.3.34 (Unix) PHP/3.0.18 mod_ssl/2.8.25 OpenSSL/0.9.6m
Connection: close
Content-Type: text/html; charset=iso-8859-1

Connection closed by foreign host.
17:05 monolith:/data/ishtar/NEW> telnet localhost 80
Trying 127.0.0.1...
Connected to spongebob-squarepants.
Escape character is '^]'.
HEAD http://localhost/ HTTP/1.1
Host: localhost

HTTP/1.1 200 OK
Date: Wed, 08 Feb 2006 16:06:26 GMT
Server: Apache/1.3.34 (Unix) PHP/3.0.18 mod_ssl/2.8.25 OpenSSL/0.9.6m
Content-Type: text/html


Connection closed by foreign host.