HTTP, testing via Telnet
From FreeBSDwiki
(Difference between revisions)
Line 1: | Line 1: | ||
− | |||
ph34r# '''telnet testdomain.tld 80''' | ph34r# '''telnet testdomain.tld 80''' | ||
Trying 192.168.0.252... | Trying 192.168.0.252... | ||
Line 29: | Line 28: | ||
</body></html> | </body></html> | ||
Connection closed by foreign host. | Connection closed by foreign host. | ||
+ | |||
+ | ==See Also== | ||
+ | |||
+ | [[Daemons, testing via Telnet]] | ||
+ | |||
+ | [[IMAP, testing via Telnet]] | ||
+ | |||
+ | [[POP3, testing via Telnet]] | ||
+ | |||
+ | [[SMTP, testing via Telnet]] | ||
+ | |||
+ | [[Category:FreeBSD for Servers]] [[Category:Common Tasks]] |
Revision as of 14:00, 29 December 2008
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.