HTTP, testing via Telnet
When troubleshooting an HTTP service, it's frequently helpful to use the telnet client to "speak" to the server directly, rather than using a mail client which won't give you the exact responses the server does. In this example, we will use telnet to connect to an HTTP server, request a web page that exists, and request a web page that doesn't exist.
ph34r# telnet testdomain.tld 80 Trying 192.168.0.252... Connected to testdomain.tld. Escape character is '^]'. GET http://www.testdomain.tld/ <html><body><h1>It works!</h1></body></html> Connection closed by foreign host.
In this case, we connected to a fictious webserver and asked it to serve us its home page. Note the response - that's a recent Apache "congratulations" page, meaning that the server hasn't really been configured properly (yet). (Usually, you'll get a MUCH longer response - typical HTML pages these days run 150K+ in size in code alone!)
Note that the GET command is in all caps - Apache is very particular about capitalization, and will not understand HTTP commands which are not in all caps!
What happens if we ask for a page that doesn't exist?
ph34r# telnet testdomain.tld 80 Trying 192.168.0.250... Connected to testdomain.tld. Escape character is '^]'. GET http://testdomain.tld/doesntexist.html <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>404 Not Found</title> </head><body> <h1>Not Found</h1> <p>The requested URL /doesntexist.html was not found on this server.</p> <hr> <address>Apache/2.0.52 (FreeBSD) PHP/5.2.1 with Suhosin-Patch Server at testdomain.tld Port 80</address> </body></html> Connection closed by foreign host.