http.header Home



Home | Http protocol | Coding references | Apache 1.3 | FAQ | About | Français


In this page, i describe how http protocol works, and give you some examples.

What is http protocol ?

Http protocol is a protocol defining communication between a server and a client in order to transfert a file. The current version is Http 1.1. See
RFC 2616 for more details.

This protocol is used as a standard to surf web sites because it suits browsing with hypertext links.


What is going on while i'm surfing the net ?

When clicking on an hypertext link, you are transfering an URL to your browser. From this URL, your browser knows which server to contact and what file to ask for.

This is exactly where the http protocol starts : connect a server and transfer a file !


Http transaction life time

During an http transaction, the requester, known as the client, asks for a file to a server.

Normal schema:
   1 Client connects to host,
   2 Server accepts connection,
   3 Client request a file,
   4 Server sends a response (including file or not).


Http Samples

Let see some classical http transactions.

First, you want the http header sample page (This page).
So you prompt in the location field of your browser "http://www.http.header.free.fr/http.html". Your browser connects to www.http.header.free.fr and sends :

>> GET /http.html Http1.1
>> Host: www.http.header.free.fr
>> Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
>> Accept-Language: Fr
>> Accept-Encoding: gzip, deflate
>> User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 4.0)
>> Connection: Keep-Alive
>>

Explanations : your browser is asking for the page called "http.html". It wants to use the http1.1 protocol. Your browser is in French and is Microsoft Internet Explorer 5.5 under WNT 4.
Your browser wants the connection (socket) stays opened between you and www.http.header.free.fr, so it can ask for further files, like pictures included in this page...
 

    In this page

Http protocole
Http samples


    References

Http codes
Http attributs


    External links

RFC 2616 (http 1.1)




 

Apache, the free.fr's web server is responding :

<< HTTP/1.1 200 OK
<< Date: Mon, 12 Mar 2001 19:12:16 GMT
<< Server: Apache/1.3.12 (Unix) Debian/GNU mod_perl/1.24
<< Last-Modified: Fri, 22 Sep 2000 14:16:18
<< ETag: "dd7b6e-d29-39cb69b2"
<< Accept-Ranges: bytes
<< Content-Length: 3369
<< Connection: close
<< Content-Type: text/html
<<
<< [File content goes here]

First of all, the free's web server knows the page you want and can send it : code 200 (see http codes page for more information). Then, you have some more infos about the server : Apache on Unix, socket closed after html page, last modification date and so on (see attributs page for more information). And finally, the requested file.


Other samples, you want the Yahoo! French home page.
Your browser doesn't know the name of the page because you prompted for the url "http://www.yahoo.fr/".
Your browser connects to the host named "www.yahoo.fr" and tries :

>> GET / Http1.0
>> Connection: Keep-Alive
>> User-Agent: Mozilla/4.7 [Fr] (Win98; I)
>> Host: www.yahoo.fr
>> Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png,
>> Accept-Encoding: gzip
>> Accept-Language: Fr
>> Accept-Charset: iso-8859-1,*,utf-8
>>

Your browser is asking for the root page of the web server. Your browser is Netscape Navigator 4.7 in french, under french Windows 98.
The server replies :

<< HTTP/1.1 302 Found
<< Date: Mon, 12 Mar 2001 19:17:03 GMT
<< Location: http://fr.yahoo.com/
<< Connection: close
<< Transfer-Encoding: chunked
<< Content-Type: text/html; charset=iso-8859-1
<<
<< [Error Html File content goes here]


Yahoo server knows the page you want, but says that it is relocated. Your browser is "redirected". So, it automaticaly tries the Url "http://fr.yahoo.com/".
Connection to host "fr.yahoo.com", then :

>> GET / Http1.0
>> Connection: Keep-Alive
>> User-Agent: Mozilla/4.7 [Fr] (Win98; I)
>> Host: fr.yahoo.com
>> Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png,
>> Accept-Encoding: gzip
>> Accept-Language: Fr
>> Accept-Charset: iso-8859-1,*,utf-8
>>

And gets a...

<< HTTP/1.0 200 OK
<< Date: Mon, 12 Mar 2001 19:20:33 GMT
<< Cache-Control: private
<< Expires: Mon, 12 Mar 2001 19:20:33 GMT
<< Connection: close
<< Content-Type: text/html
<< Set-Cookie: B=460soc0taq8c1&b=2; expires=Thu, 15 Apr 2010 20:00:00 GMT; path=/; domain=.yahoo.com
<<
<< [File content goes here]

You haven't seen anything...




Matthieu Delgrange 2006 - http.header@netcourrier.com - Home