HTTP: Response Messages
Let's look at what HTTP response messages look like!
We'll cover the following...
Introduction
Letās start with a typical example of an HTTP response message:
Press + to interact
HTTP/1.1 200 OKConnection: closeDate: Tue, 18 Aug 2015 15: 44 : 04 GMTServer: Apache/2.2.3 (CentOS)Last-Modified: Tue, 18 Aug 2015 15:11:03 GMTContent-Length: 6821Content-Type: text/html[The object that was requested]
It has three parts: an initial status line, some header lines, and an entity body.
š HTTP response messages donāt have the URL or the method fields. Those are strictly for request messages.
Status line
- HTTP response status lines start with the HTTP version.
Status code
- The status code comes next, which tells the client if the request succeeded or failed.
- There are a lot of status codes:
- 1xx codes fall in the informational category
- 2xx codes fall in the success category
- 3xx codes are for redirection
- 4xx is a client error
- 5xx is a server error
Here is a list of some common status codes and their meanings:
-
200 OK
: the request was successful, and the result is appended with the response message. -
404 File Not Found
: the ...