

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


By Kimani Njoroge Page 1
HTTP means HyperText Transfer Protocol. A protocol is a collection of rules that guide communication between and among computers. That is, whenever two or more computers need to communicate, there are guidelines used to determine the communication. One has to send a message and the other listen or receive the message and acknowledge receipt.
HTTP uses a simple conversation pattern: the client connects to the server with a socket, initiates the dialog by asking the server for something, the server then tries to provide the client an answer back.
An analogy of a simple HTTP request and response would be the client asking "give me the file A" and the server answering "I have it, here is the content of file A: (...content of file A...)".
Loading a web page: When a browser loads a web page, it does a GET request for the URL requested. The content of the page is usually in a special text format called html, that allows one to include links, images and other style effects. The browser analyses the html in order to display it to the user. But doing so it may find that it needs more content to render the page correctly, like images. When that happens, the browser initiates one HTTP request for each image. When all the necessary information is downloaded, it is combined into the page the user sees on his screen.
Experiment : Telnet is a program that lets you establish a socket connection to a server and manually type the characters you want to send. The command-line syntax varies a little bit, but the principle stays the same: you want to provide the name of the server and a port number. The standard port number for HTTP is 80.
By Kimani Njoroge Page 2
Try the following: In a windows command prompt, type "telnet google.com 80" followed by return. A connection will get opened and you are now free to send characters to the google server. You can quit the telnet program at anytime, by hit (ctrl) then type " quit " followed by return. Continue typing: "GET / HTTP/1.0", followed by return twice. Depending on the telnet program, the characters you type might appear in the console, or not (but you can type it blindly).
This is the simplest request you can send. The extra blank line signifies the end of the request and as soon as you type it, the google server will start replying something like:
HTTP/1.1 200 OK Content-length: 3266 Date: Fri, 26 Mar 2004 22:13:00 GMT Content-Type: text/html Cache-control: private Set-Cookie: ID=09ac55c2fbb3def1; expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/; domain=.google.com Server: GWS/2. (... google's html page ...)