in reply to HTTP request
send($sock,"GET /HTTP/1.1\n\n",0);
You need a space between the '/' (standing for the resource to get — here top-level / document root) and the protocol (HTTP/1.1):
send($sock,"GET / HTTP/1.0\n\n",0); ^
See HTTP Request message.
___
P.S. You should normally use \r\n as newlines, as specified in the HTTP protocol — although \n is typically also understood (most web servers and browsers are rather error-tolerant).
If you use print instead of send, you can also apply the :crlf PerlIO layer:
binmode $sock, ":crlf"; print $sock "GET / HTTP/1.0\n\n";
(for some reason, the layer seems to be ignored with send)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: HTTP request
by sauoq (Abbot) on Mar 13, 2011 at 15:01 UTC | |
by afoken (Chancellor) on Mar 14, 2011 at 17:31 UTC | |
by sauoq (Abbot) on Mar 15, 2011 at 18:21 UTC |