In this post I will explain what HTTP is.
HTTP is an abbreviation of HyperText Transfer Protocol and is an application protocol to enable communication between physically dispersed systems.
In its most basic format it forms the basis for how web pages are communicated from the web server to the user’s browser.
HyperText itself is the text used on web pages which connects one page to another page, whether within the same system or externally. It is the links that connect content on the internet.
How Does HTTP Work?
HTTP is an Application Protocol for transferring Resources across the internet. HTTP uses Port 80. Which is the port that the Web Server accepts requests from. Most Resources are files (images, etc.) but can include other data such as output from scripts.
HTTP sessions are opened by an HTTP Client (i.e. the user’s browser) via a user agent and a connection Request Message is sent to an HTTP Server (i.e. the Web Server). The Request Message is also known as the ‘Client Request’ and consists of the following lines:
- Request line
- An empty line
- An optional message body
Once the response has been delivered the Web Server closes the connection. This type of connection is known as Stateless in that it exists only for the duration of the data exchange.
Depending on the availability or otherwise of the Resource HTTP provides an appropriate status code (also referred to as the ‘Server Response’) determined by the protocol. These are as follows:
1xx – an informational message only
2xx – success of some kind, e.g: 200 OK – file found
3xx – the client to another URL, e.g: 301 moved permanently
4xx – an error on the client’s part, e.g: 404 – file not found
5xx – an error on the server’s part, e.g: 500 server error
Secure HTTP (HTTPS)
There is a more secure version of HTTP known as HTTPS. This typically involves the use of an SSL Certificate which creates a secure, encrypted connection between the browser and the web server.
This is typically used for secure areas of websites where sensitive data is transferred such as payment details or login credentials. In recent years though HTTPS has been listed as a Google ranking factor and more and more websites are moving to HTTPS for that reason.
Whereas HTTP uses port 80, HTTPS uses port 443 for communication.
We hope you have found this tutorial useful on what HTTP is.
Thanks for reading and leave your questions below to keep the conversation going.