response message is a message which is sent in response to request message.
picture shows general format of HTTP request message.
take one example to understand it more deeply.
Sat,07 Jul 2010 12:00:15 GMT
modified: Sun,6 May 2010 09:23:24 GMT
data data data……)
message has three sections:
an initial status line
Line:the start line of HTTP response is called status line.
It has three fields:
protocol version field
status code which indicates failure of the request
corresponding status message
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
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:
headers, e.g., Via, which applies to the whole message.
Response headers, e.g., Vary and Accept-Ranges, which gives additional
information about the server which doesn’t fit in the status line.
Entity headers, e.g., Content-Length, which applies to the body of the request.
Obviously no such headers are transmitted when
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.