pavement

HTTP, testing via Telnet

From FreeBSDwiki
Revision as of 13:52, 29 December 2008 by Jimbo (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
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.
Personal tools