Everyone: Anyway, I think this thread is done. I'll go ahead and close it now. If further discussion is warranted, go ahead and start a new thread and link back to this one as appropriate.
]]>nc send what you are typing in raw mode, so it does not send any CRLF when you hit enter, and lighttpd is not tolerant with newlines.
bsd netcat have the -C option to send CRLF as line-endings.
nc -C localhost 80
Please mark as solved, if it works. Thanks.
]]>So I guess I just haven't been inputting the right characters. Should have followed the specs. But the same thing seems to work for majority of servers I've tried (maybe Apache is the reason).
]]>echo -e "GET http://localhost HTTP/1.0\r\n\r\n" | nc -w 5 localhost 80
I have simple lighttpd setup -> I can browse localhost through web browser without any problems.
Using netcat -> I can connect to foreign servers and get response.
[skyer@sigma-arch ~]$ nc google.com 80
GET / HTTP/1.1
Host: google.com
HTTP/1.1 301 Moved Permanently
... and the rest of response from google.com
I'm trying to diagnose why port forwarding doesn't work with my zyxel router, but I can't connect to lighttpd using netcat.
[skyer@sigma-arch ~]$ nc localhost 80
GET / HTTP/1.1
Host: localhost
and nothing comes back, so I exit using Ctrl+C. (Note: there are few new lines which this forum's BB code parser seems to ignore)
Also, web server's access log doesn't list my attempt to connect. As you've probably figured out by now, I'm not very experienced. It could be a problem with my lighttpd configuration or I just can't use netcat properly. Feel free to ask for additional information, and thanks for any answers.
]]>