Response (Response) in HTTP
After receiving and interpreting a request message, a Server sends a response signal with an HTTP response message.
After receiving and interpreting a request message, a Server sends a response signal with an HTTP response message.
- A status line (Status-Line)
- No more or more Header (General | Response | Entity) fields followed by CRLF.
- A blank line (for example, a line that has nothing before CRLF) indicates the end of the Header fields.
- An informative body part.
The following areas explain the usage of each object in an HTTP response message.
Status line
A status line includes the protocol version followed by a numeric encoding and its associated text.
Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLF
HTTP version
A server supporting HTTP / 1.1 version will return version information as follows:
HTTP-Version = HTTP / 1.1
Encrypt status
The Status-Code element is a 3-character integer, in which the first character of the status encoding defines the response type and the last two characters do not have any sorting role. There are 5 values of the first character:
STONE and description1 1xx: InformationIt means that the request has been received and the process is continuing.
2 2xx: SuccessfulIt means that the activity has been received, understood, and successfully accepted.
3 3xx: RedirectionIt means that the operation must be done to fulfill the request.
4 4xx: Client errorIt means that the request contains an incorrect or not implemented syntax.
5 5xx: Server ErrorIt means that Server failed with making a request that looks like it looks feasible.
HTTP status encoding is scalable and HTTP applications are not required to understand the meaning of all registered status codes. A list of all status codes has been provided in a separate chapter for your reference.
Feedback Header fields
We will learn General-Header and Entity-Header in a separate chapter when we will learn about Header fields. Now, let's find out what feedback Header fields are:
The Feedback Header fields allow the Server to transmit additional information about responses that cannot be placed in the Status-Line line. These header fields provide information about the server and remote access to the source identified by the Request-URI.
Accept-Ranges
Age
ETag
Location
Proxy-Authenticate
Retry-After
Server
Vary
WWW-Authenticate
You can create your own fields in case you are writing Client and Server for yourself.
Examples of Feedback Notifications
Now we put all of the above together to create an HTTP response for a request to instruct the hello.jsp page from the Server running on tutorialspoint.com.
HTTP/1.1 200 OK Date: Mon, 27 Jul 2009 12:28:53 GMT Server: Apache/2.2.14 (Win32) Last-Modified: Wed, 22 Jul 2009 19:15:56 GMT Content-Length: 88 Content-Type: text/html Connection: Closed
Hello, World!
The following example shows an HTTP response message that displays the error status when the Server cannot find the requested page:
HTTP/1.1 404 Not Found Date: Sun, 18 Oct 2012 10:36:20 GMT Server: Apache/2.2.14 (Win32) Content-Length: 230 Connection: Closed Content-Type: text/html; charset=iso-8859-1
404 Not Found
Not Found
The requested URL /t.html was not found on this server.
Next is an example of an HTTP response message indicating the error state when the Server enters a wrong HTTP version in the HTTP request provided:
HTTP/1.1 400 Bad Request Date: Sun, 18 Oct 2012 10:36:20 GMT Server: Apache/2.2.14 (Win32) Content-Length: 230 Content-Type: text/html; charset=iso-8859-1 Connection: Closed
400 Bad Request
Bad Request
Your browser sent a request that this server could not understand.
The request line contained invalid characters following the protocol string.
According to Tutorialspoint
Previous post: Request (HTTP) in HTTP
Next lesson: Method in HTTP
You should read it
Maybe you are interested
How to Backup Android Data to Google Clouds on Neptune may be created by the Sun The planet has the fastest wind in the solar system, reaching a speed of 2,400 km/h Foods that help increase memory 12 super foods you should have on the menu 3 times gold should eat yogurt is better than taking supplements