Home >>HTTP Tutorial >HTTP Response
HTTP Response sent to the client through a server. The response is used to provide the resource you requested to the client. It is often used to remind the client that the required action has taken place. It may also notify the client that there was an error in processing his request.
An HTTP response contains the following things:
Any HTTP header is accompanied by a carriage return line feed (CRLF) in the request message. A further CRLF is used after the last of the HTTP headers, and then the message body begins.
The status line is the first row in the response message. The status line is composed of three items:
It is a three-digit number indicating the end result of the query. The first digit defines response class. The last two digits have no role in categorization. The first digit has 5 values which are as follows:
It is also regarded as the text for status. It's a human-readable text that makes up the importance of the status code.
One example of the response line is:
HTTP/1.1 200 OK
Here,
HTTP-Version = HTTP/1.1
It shows the request has been received, and the process has proceeded.
2xx: SuccessIt indicates that the action was successfully received, understood, and accepted.
3xx: RedirectionIt indicates that further action is needed to complete the request.
4xx: Client ErrorIt indicates that there is an incorrect syntax in the request, or that it can not be fulfilled.
5xx: Server ErrorIt indicates that a valid request was not fulfilled by the Server.
The server response HTTP headers contain the details a client may use to find out more about the response, and about the server that sent the response. This information is used to help the client view a user 's response, to store the response for future use, and to make more requests to the server now or in the future.
response-header = Accept-Ranges | Age | ETag | Location | Proxy-Authenticate | Retry-After | Server | Vary | WWW-Authenticate
The Response-header field name can be reliably extended only in conjunction with a protocol version update.
The message body of the response can be referred to as a response body for convenience.
For most responses the message body is used. The exceptions are where a server uses such status codes and the server responds to a request from the client, which asks for the headers but not the response body.
For a response to a successful request, the message body contains either some information about the status of the action that the client requests, or the resource that the client requests. In order to respond to an unsuccessful request, the message body may provide additional information about certain actions that the client needs to take to complete the request successfully or about the reason for the error.