What Is HTTP
What Is HTTP
The Hypertext Transfer Protocol (HTTP) is the foundation of the World Wide
Web, and is used to load web pages 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. A typical flow over HTTP involves a client machine making a request to a
server, which then sends a response message.
Each HTTP request made across the Internet carries with it a series of encoded
data that carries different types of information. A typical HTTP request
contains:
2. a URL
3. an HTTP method
Let’s explore in greater depth how these requests work, and how the contents
of a request can be used to share information.
HTTP headers contain text information stored in key-value pairs, and they are
included in every HTTP request (and response, more on that later). These
headers communicate core information, such as what browser the client is
using what data is being requested.
The body of a request is the part that contains the ‘body’ of information the
request is transferring. The body of an HTTP request contains any information
being submitted to the web server, such as a username and password, or any
other data entered into a form.
HTTP status codes are 3-digit codes most often used to indicate
whether an HTTP request has been successfully completed. Status
codes are broken into the following 5 blocks:
0. 1xx Informational
1. 2xx Success
2. 3xx Redirection
Status codes starting with the number ‘2’ indicate a success. For
example, after a client requests a web page, the most commonly
seen responses have a status code of ‘200 OK’, indicating that
the request was properly completed.
If the response starts with a ‘4’ or a ‘5’ that means there was an
error and the webpage will not be displayed. A status code that
begins with a ‘4’ indicates a client-side error (It’s very common
to encounter a ‘404 NOT FOUND’ status code when making a
typo in a URL). A status code beginning in ‘5’ means something
went wrong on the server side. Status codes can also begin with
a ‘1’ or a ‘3’, which indicate an informational response and a
redirect, respectively.