The Hypertext Transfer Protocol loads pages on the Internet using hyperlinks invoking http:// over port 80 typically.
What is HTTP?
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 network protocol stack layers. A typical flow over HTTP involves a client machine requesting a server, which sends a response message.
What is in an HTTP request?
An HTTP request is the way. Internet communications platforms such as web browsers ask for information to load a website.
Each HTTP request made across the Internet carries a series of encoded data containing different information types. A typical HTTP request contains:
- HTTP version type
- a URL
- an HTTP method
- HTTP request headers
- Optional HTTP body.
Let’s explore in greater depth how these requests work and how the contents of a request can be used to share information.
What is an HTTP method?
An HTTP method, sometimes referred to as an HTTP verb, indicates the action that the HTTP request expects from the queried server. For example, two of the most common HTTP methods are ‘GET’ and ‘POST’; a ‘GET’ request expects information back in return (usually in the form of a website), while a ‘POST’ request typically indicates that the client is submitting information to the web server (such as form information, e.g., a submitted username and password).
What are HTTP request headers?
HTTP headers contain text information stored in key-value pairs. They are included in every HTTP request (and response; more later) and communicate core information, such as what browser the client is using and what data is being requested.
Example of HTTP request headers from Google Chrome’s network tab:
What is in an HTTP request body?
The body of a request is the part that contains the information the request is transferring. An HTTP request’s body includes any information submitted to the web server, such as a username and password or any other data entered into a form.
What is in an HTTP response?
An HTTP response is what web clients (often browsers) receive from an Internet server in answer to an HTTP request. These responses communicate valuable information based on what was asked for in the HTTP request.
A typical HTTP response contains the following:
- An HTTP status code
- HTTP response headers
- optional HTTP body
- 1xx Informational
- 2xx Success
- 3xx Redirection
- 4xx Client Error
- 5xx Server Error