Vous êtes sur la page 1sur 19

WWW and HTTP

WWW-World Wide Web


It is repository of information linked together from points all over the world. The WWW project was initiated by CERN (European Laboratory for Particle Physics) to create a system to handle distributed resources necessary for research work. WWW today is distributed client/server service, in which a client using a browser can access a service from a server.

Architecture:

WWW - Architecture
Client (Browser): each browser consist of three partsa controller, client protocol, and interpreter. - a variety of vendors offer commercial browsers that interprets and display a Web document. Server: the web page is stored at the server. - a server can become more efficient through multithreading or multiprocessing. URL: a client that wants to access a web page needs the address. To facilitate the access of documents distributed throughout the world, HTTP uses locator. - the URL is a standard for specifying any kind of information on the internet. - it defines 4 things: protocol, host computer, port & path. Cookies: a string of characters that holds some information about the client and must be returned to the server.

WWW - Architecture
Web Documents: HTML, DHTML etc

Client (Browser)

Protocol :// Host : Port / Path


URL

HTTP - Hypertext Transfer Protocol


It is used mainly to access data on the WWW. HTTP functions as a combination of FTP and SMTP. Like FTP: it transfers the files and uses the services of TCP. Like SMTP: the data transferred between client and server look like SMTP messages. - The format of message is controlled by MIME like headers. - Unlike SMTP, the HTTP messages are not destined to be read by humans, they are read and interpreted by the HTTP server and HTTP client (browser). - SMTP messages are stored and forwarded, but HTTP messages are delivered immediately. HTTP uses the services of TCP on well-known port

80.

HTTP Transaction
Although based on TCP service, HTTP is a stateless protocol. The client initializes the transaction by sending a request message. The server replies by sending a response.

HTTP Transaction: Messages


The format of the request and response messages are similar. A request message consists of a request line, a header and sometimes a body. A response message consists of a status line, a header and sometimes a body.

HTTP Transaction: Messages


Request and Status Lines: - First line in Request Message is called a Request Line. - First line in Response Message is called a Status Line. - There is one common field i.e. HTTP version.

Request Line

Status Line

HTTP Transaction: Messages


Request Type - Used in the Request Message, in version 1.1 of HTTP, several request types are defined. The request type is categorized into methods.
Method
GET HEAD POST PUT TRACE CONNECT OPTION

Action
Requests a document from the server Requests information about a document but not the document itself Sends some information from the client to the server Sends a document from the server to the client Echoes the incoming request Reserved Inquires about available options

HTTP Transaction: Messages


URL Uniform Resource Locator. Version Current version is HTTP 1.1 Status Code it is similar to those in the FTP and SMTP. It consist of 3 digits. - codes in the 100 range are only informational. - codes in the 200 range indicate a successful request. - codes in the 300 range used to redirect the client to another URL. - codes in the 400 range indicate an error at the client site. - codes in the 500 range indicate an error at the server site. - Most common codes are shown in the following table Status Phrase- used in the response message. It explains the status code in text form.

HTTP Transaction: Messages


Status code
Code Phrase Description

Informational
100 101 Continue Switching The initial part of the request has been received, and the client may continue with its request. The server is complying with a client request to switch protocols defined in the upgrade header.

Success
200 201 202 204 OK Created Accepted No content The request is successful. A new URL is created. The request is accepted, but it is not immediately acted upon. There is no content in the body.

HTTP Transaction: Status codes ..


Code Phrase Description

Redirection
301 302 304 Moved Permanently Moved Temporarily Not modified The requested URL is no longer used by the server. The requested URL has moved temporarily. The document has not been modified.

Client Error
400 401 403 404 405 406 Bad Request Unauthorized Forbidden Not found Method not allowed Not Acceptable There is syntax error in the request. The request lacks proper authorization. Service is denied. The document is not found. The method is not supported in this URL. The format requested is not acceptable.

HTTP Transaction: Status codes ..


Code Phrase Description

Server Error
500 Internal Server error Not Implemented Service unavailable There is an error, such as crash, at the server site. The action requested cannot be performed.

501

503

The service is temporarily unavailable, but may be requested in future.

HTTP Transaction: Message header


Header exchanges additional information between the client and the server. A header line belongs to any one of the four categories: General header, Request header, Response header and Entity header.

Message Header Format

Header Type: General Header


It gives general information about message and can be present in both Request and Response message.
Header Cache Control Connection Date MIME version Upgrade Description Specifies information about caching Shows whether the connection should be closed or not. Shows the current date. Shows the MIME version used. Specifies the preferred communication protocol.

Header Type: Request Header


It can be present in only Request message. It specifies the clients configuration and clients preferred document format.
Header Accept Accept-char set Accept-encoding Accept-language Authorization From Post If-modified-since If-match If-non-match If-range If-unmodified-since Referrer User-agent Description Shows the medium format the client can accept. Shows the character set the client can handle. Shows the encoding scheme the client can handle. Shows the language the client can accept. Shows what permission the client has. Shows the e-mail address of the user. Shows the host and port no. of the server. Sends the document if newer than specified date. Sends the document only if it matches given tag. Sends the document only if it does not match given tag. Sends only the portion of the document that is missing. Sends the document if not changed since specified date. Specifies URL of the linked document. Identifies the client program.

Header Type: Response Header


It can be present in only Response message. It specifies the servers configuration and special information about the request.
Header Accept range Age Public Retry-after Server Description Shows if server accepts the range requested by the client. Shows the age of the document. Shows the supported list of methods. Specifies the date after which the server is available. Shows the server name and version number.

Header Type: Entity Header


It gives information about the body of the document. It is mostly present in Response messages and in some Request messages such as POST or PUT methods.
Header Allow Content-encoding Content-language Content-length Content-range Content-type Etag Expires Last-modified Location Description Lists valid methods that can be used with the URL. Specifies the encoding scheme. Specifies the language Shows the length of the document. Specifies the range of the document. Specifies the medium type. Gives an entity tag. Gives the date and time when contents may change. Gives the date and time of last change. Specifies the location of created or moved document.

HTTP Transaction: Message Body


The body can be present in a Request and Response message. Usually it contains the document to be sent or received.

HTTP Example
This example retrieves a document. The request line shows the method (GET), the URL and HTTP version. The header has two lines that shows the client can accept image in GIF or JPEG format. The request does not have body. The response message contains the status line and four lines of header. The header lines define the date, server, MIME version and the length of the document. The body of the document follows the header .

Thank YOU