HTTP Sun,6 May 2010 09:23:24 GMT Content-length: 5428

HTTP RESPONSE

Basically,
response message is a message which is sent in response to request message.

We Will Write a Custom Essay Specifically
For You For Only $13.90/page!


order now

Below
picture shows general format of HTTP request message.

 

 

 

 

Let us
take one example to understand it more deeply.

 

HTTP/1.1
200 OK

Connection:
close

Date:
Sat,07 Jul 2010 12:00:15 GMT

Server:
Apache/1.3.0(Unix)

Last
modified: Sun,6 May 2010 09:23:24 GMT

Content-length:
5428

Content-type:
text/html

 

(data
data data data……)

 

 

·        
Response
message  has three sections:

(i)
an initial status line

(ii)six
header lines

(iii)entity
body

 

§ 
Status
Line:the start line of HTTP response is called status line.

It has three fields:

(1)  
The
protocol version field

(2)  
A
status code which indicates failure of the request

(3)  
A
corresponding status message

In
above example, status line indicates that server is using HTTP/1.1 which is
protocol version .200 is the status code and OK is corresponding status message
which indicates that everything is OK.

§  Header lines: It follows the same structure as any other header: a case-insensitive
string followed by a colon (‘:’) and a value whose structure depends upon the type of the header. The
whole header, including its value, presents as a single line.

In above example, server uses Connection : close  header line and tell the client that it is
going to close TCP connection after sending message.

In above example, the Date header line indicates the time and date when
HTTP response message was created and sent by server.Here note that it is not
the when the object was created or last modified, it is the time when server
retrieves the objects from its file system and inserts the object into the HTTP
response and sends it.

In above example the server header line indicates that the message is
served (generated) by apache web server .

In above example,  User-agent
which is analogous by server is a response header line.

In above example,Last-Modified header line indicates the date and time
when the object was created and last modified.It is critical for object
caching.

In above example, Content-Length header line indicates that the object
in the entity body is HTML text.

 

 

 

 

 

There are so many response
headers are available. We can divide it in some several groups:

 

(i)                
 General
headers, e.g., Via,  which applies to the whole message.

(ii)              
Response headers, e.g., Vary and Accept-Ranges,  which gives additional
information about the server which doesn’t fit in the status line.

(iii)            
Entity headers, e.g., Content-Length, which applies to the body of the request.
Obviously no such headers are transmitted when

(iv)            
there is no body in the request.

 

 

 

§  Entity Body: The last part
of a response message is the body. Not all responses have one: responses with a
status code, like 201 or 204, usually don’t.

Bodies can be divided into three categories:

·        
Single-resource bodies,which consists of a single file of known length  are defined by the two headers: Content-Type and Content-Length.

·        
Single-resource bodies, which consists of a single file of unknown
length are encoded by chunks with Transfer-Encoding set to chunked.

·        
Multiple-resource bodies, which consists of a multipart body, each contains
a different section of information. These are relatively rare.