HTTP: The transmission protocol of the Web
HTTP is a good protocol to start with, because it is extremely
simple. HTTP requests normally happen on port 80.
Most HTTP servers close the connection after a command is successfully
completed. Some modern servers, when using HTTP/1.1, hold the connection open, allowing further
requests to occur after completion. On such servers, the QUIT command
is used to close the connection.
There is only one command in the HTTP protocol that we are going to demonstrate here,
the GET command. It's syntax is:
GET path/file HTTP/1.0
An example use of the command would be:
GET / HTTP/1.0
If you were using this on the server www.cnn.com, you would recieve
the HTML components of the webpage: http://www.cnn.com/
A nonobvious thing about webpages is that browsers normally perform many
requests to get a single webpage. Browsers first request the HTML file for the page,
and make a list of embedded objects in the page that are needed to view it.
They then issue requests for each of the objects (images, inline midi, etc.). If, for example,
you direct your browser to get http://www.cnn.com/WEATHER/, it
- Connects to port 80 of www.cnn.com, and issues the command:
GET /WEATHER HTTP/1.0
- Starts rendering index.html as it comes across, and starts building
index of embedded files it needs (each image, flash animation, and possibly other object)
- Issues GET commands for each other file it needs
- Renders them into the page as it recieves them
RFC2068 decribes the HTTP 1.1 protocol, including much that is not
commonly used or implemented.