Introduction to HTTP
![]()
HTTP is the core operation protocol of the world wide web (www).
It is what enables your web browser to communicate with a web server that hosts a website.
HTTP is the communication protocol you use when you browse the web.
HTTP Stands for Hypertext Transfer Protocol.
It's a protocol used to transfer web resources such as HTML document Images Styles and other files.
HTTP is a Request-response based protocol the web browser or client sends an HTTP request to a server and the web server sends the HTTP response back to the browser.
The makeup of an HTTP request
- Method e.g. GET
This describes the type of action the client wants to perform.
Commonly used methods are:
// GET: - Retrieve information from a given server
// POST: - Send information to a given Server
// PUT: - Update What’s on the server with something else
// DELETE: - Removes the resource
- Path e.g. '/'
This is the representation of where the resource is in the server.
// e.g.: 'MatthewOpoola.com/about'
- Version
e.g. HTTP/1.1
There are multiple versions of the HTTP most commonly used ones are 1.1 and 2.0
- Headers
e.g. Host: developer.mozilla.org, Accept-Language: en
This contains additional information about a request and the client making the request.
The makeup of HTTP Response
HTTP responses follow a similar format to the HTTP request as stated above with some additions below.
Message body
<html>
<body>
<p>Hello World</p>
</body>
</html>"
This consist of the response content such as the file and so on.
Status codes
This is found in the header. This states if the HTTP request is completed. The current value is between 100 and 599, and they are grouped by purpose.
Groups of Status code
Informational: - 100 to 199
These are provisional and interim responses. The most common is 100
Successful: - 200 to 299
This implies that the request has been successfully processed by the web server. The most common is 200 – we receive this response every day when we successfully view a website.
Redirection: - 300 to 399
This indicates to the web resource has been moved to a different path.
The most common is 301 (Moved Permanently) and 302 (Found)
Client error: - 400 to 499
This indicates bad syntax and cannot be processed by the web server.
The most common are: -
400 – This is used when a client or browser is submitting bad data to the webserver
401- This is used to indicate that the client must log into an account before the request can be processed.
403 – This is used to indicate that the request was valid but the web server is refusing to process the request, this is often indicating that the user doesn’t have sufficient permission to execute the action in the web application.
404 – This is used to indicate that the web resource was not found.
Server error: - 500 to 599
This indicates that a failure occurred on the web server while trying to process the request.
The most common code used is 500 (Internal Server Error) this is a generic error indicating that the server failed to process the request.
Summary
Firstly HTTP, is a protocol used by web clients and web servers. It works to transfer web resources such as HTML files and as the foundation of any data exchanges on the web. Also, let me add here that by using HTTPS, we send the information securely. Requests are sent by the client, usually a web browser, and the server replies with responses which may be the return of an image or an HTML page. HTTP requests have a syntax that includes method, path, versions, and headers. HTTP responses follow a similar format to the request. An HTTP status codes indicate whether the HTTP requests successfully completed. The status code is a three-digit number that corresponds with groups representing different types of results. Now you know how the HTTP protocol request and response cycle works. You know about its methods and the elements that make up an HTTP request. Good job.



