Hypertext Transfer Protocol (HTTP)

About

The Hypertext Transfer Protocol (HTTP) is the foundation of the World Wide Web, and is used to load webpages using hypertext links. HTTP is an application layer protocol designed to transfer information between networked devices and runs on top of other layers of the network protocol stack.1.

Typical HTTP Flow

A typical flow over HTTP involves a client machine making a request to a server, which then sends a response message1.

HTTP headers

See HTTP headers

HTTP request

See HTTP request

HTTP response

It is what the clients (e.g. browsers) receive from an Internet server in response/ answer to an HTTP request. They communicate valuable information based on what was requested/ asked for in the HTTP request. They typically contain:

  1. an HTTP status code
  2. HTTP response headers
  3. optional HTTP body

HTTP status code2

It is a 3-digit code used to indicate whether an HTTP request has been successfully completed. They are broken into 5 blocks:

Status CodeStatus Code MessageStatus Code Description
100-199Information Responses-
100ContinueAn interim response which indicates that the client should continue the request or ignore the response if the request is already finished
101Switching ProtocolsThe code is sent in response to an Upgrade request header from the client and indicates the protocol the server is switching to
102ProcessingIt was used with WebDAV contexts to indicate that a request has been received by the server, but no status was available at the time of the response
103Early HintsPrimarily intended to be used with the Link header, letting the user agent start preloading resources while the server prepares a response or preconnect to an origin from which the page will need resources
200-299Success Responses-
200OKThe request succeeded. The result and meaning of “success” depends on the HTTP method: GET: the ressource has been fetched and transimitted in the message body; HEAD: representation headers are included in the response without any message body; PUT or POST: the resource describing the result of the action is transimitted in the message body; TRACE: the message body contains the request as received by the server
201CreatedThe request succeeded, and a new resource was created as a result. This is typically the response sent after POST requests, or some PUT requests
202AcceptedThe request has been received but not yet acted upon. It is noncommittal, since there is no way in HTTP to later send an asynchronous response indicating the outcome of the request. It is intended for cases where another process or serer handles the request, or for batch processing.
203Non-Authoritative InformationThis response code means the returned metadata is not exactly the same as is available from the origin server, but is collected from a local or a third-party copy. This is mostly used for mirriors or backups of another resource. Excdpt for that specific case, the 200 OK response is preferred to this status
204No ContentThere is no content to send for this request, but the headers are useful. The user agent may update its cached headers for this resource with the new ones.
205Reset ContentTells the user agent to reset the document which sent this request.
206Partial ContentThis response code is used in response to a range request when the client has requested a part or parts of a resource.
207Multi-Status (WebDAV)Conveys information about multiple resources, for situations where multiple status codes might be appropriate.
208Already Reported (WebDAV)Used inside a <dav:propstat> response element to avoid repeatedly enumerating the internal members of multiple bindings to the same collection.
226IM Used (HTTP Delta encoding)The server has fulfilled a GET request for the resource, and the response is a representation of the result of one or more instance-manipulations applied to the current instance.
300-399Redirection Messages-
300Multiple ChoicesIn agent-drien content negotiation, the request has more than one possible response and the user agent or user should choose one of them. There is no standardised way for clients to automatically choose one of the responses, so this is rarely used.
301Moved PermanentlyThe URL of the requested resource has been changed permanently. The new URL is given in the response.
302FoundThis response code means that the URL of the requested resource has has changed temporarily. Further changes in the URI might be made in the future, so the same URI should be used by the client in future requests.
303See OtherThe server sent this response to direct the client to get the requested resource at another URI with a GET request.
305Use ProxyDefined in a previous version of HTTP specification to indicate that a requested response must be accessed by a proxy. It has been deprecated due to security concerns regarding in-band configuration of a proxy.
306unusedThis response code is no longer used; but is resereved. It was used in a previous version of the HTTP/1.1 specification.
307Temporary RedirectThe server sends this response to direct the client to get the requested resource at another URI with the same method that was used in the prior request. This has the same semantics as the 302 Found response code, with the exception that the user agent must not change the HTTP method used: if a POST was used in teh first request, a POST must be used in the redirected request.
308Permanent RedirectThis means that the resource is now permanently located at another URI, specified by the Location response header. This has the same semantics as the 301 Moved Permanently HTTP response code, with the exception that the user agent must not change the HTTP method used: if a POST was used in the first request, a POST must be used in the second request.
400-499Client Error Responses
400Bad RequestThe server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax
400
500 - server errorServer Error Responses

Anki

References


  1. Cloud Flare. “Hypertext Transfer Protocol (HTTP)”. Available at: https://www.cloudflare.com/learning/ddos/glossary/hypertext-transfer-protocol-http/ . (Accessed: [2025-05-06 Tue 04:42]). ↩︎ ↩︎

  2. Mozilla Developer Network. “HTTP response status codes”. Available at: https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status#informational_responses . (Accessed: [2025-05-06 Tue 16:07]). ↩︎

Random Posts