The Web Without a Web Browser

For those of you who aren’t familiar with the HTTP protocol, we’re going to write some HTTP requests and see the responses we get from web servers. To accomplish this, we’re going to use Telnet.

Telnet

Telnet is a networking tool, and that’s all you need to know for these tutorials.

The more important matter is how you can use Telnet to view the HTTP responses from your CGI scripts.

On an ENCS machine, boot into Linux, and open a command line. Type the following:
(the ‘$’ is supposed to be the prompt, so don’t type that)

$ telnet encs.concordia.ca 80

You’re now connected to a Concordia web server via Telnet, and can manually type out an HTTP request. If at any time you want (or need) to exit, you hold ‘ctrl’+']’ to disconnect; then type ‘quit’ and you should exit Telnet.

Try typing the following:

GET / HTTP/1.1
Host: encs.concordia.ca

Take note that you have to type the blank line after the request headers. As soon as you type in this blank line, you should see a response from the server.

… and it will be MASSIVE. It will probably not fit on the sreen.

Your ENCS Web Space

So that this exercise is a little more useful, we’re going to put a smaller HTML document on a Concordia web server and do it again.

You – as an ENCS user – have a web space available to you. The path to your web space is:

/www/home/r/r_leguen/

… where you replace ‘r/r_leguen’ with the first letter of your ENCS username, and your ENCS username.

In your web space directory, create a file, and call it ‘index.html’. Make it a small HTML document: