We’ll learn about the basics of HTTP in this article.
Table of Contents
Academics and researchers utilized an arcane collection of email and information transfer protocols called the Internet.
The World Wide Web was developed to enable the presentation of content connected by hypertexts by the European research group CERN. But when it attracted the public’s attention and made the Internet popular, everything was different.
The web provided material depending on demand, which set it apart from traditional services like cable television. What people wanted to watch was available. The HyperText Transfer Protocol, or HTTP, is the fundamental protocol of the internet.
- Web pages are objects made up of other objects.
- Simply said, an object is a file, such as an HTML file, PNG file, MP3 file, etc.
- Each object has a URL (Uniform Resource Locator).
- A web page’s base object is often an HTML file that contains references to other objects via performing URL queries for them.
- The most common markup language used to create websites is HTML or HyperText Markup Language.
The Structure of a URL
Files that are stored on servers may be found using a URL, or universal resource locator. The following components are found in URLs,
- Protocol in use
- The server’s hostname
- The file’s location
- Arguments to the file
Returning to HTTP now. It describes how Web clients ask Web servers for Web pages and how Web servers provide them. It is a client-server protocol.
Recall the illustration from the Network Application Architectures article? Actually, it was a broad overview of HTTP.
An HTTP request is the first communication, while an HTTP response is the second. Request-response protocols are a broad category of protocols. One of them is HTTP.
Because HTTP is a stateless protocol, it should be noted that servers by default do not keep any client-specific data. Therefore, if a client requests an item repeatedly, the server will provide it without realizing it is coming from the same client.
Lower Layer Reliability is Required for HTTP
- Application layer protocols are dependent on underlying transport layer protocols called UDP (User Datagram Protocol) and TCP (Transmission Control Protocol).
- You just need to be aware of TCP’s ability to guarantee message delivery for the time being. In the sequence that they are sent, messages are delivered.
- The delivery of messages is not ensured by UDP. As a result, it’s possible that some communications may be lost and never be received.
- TCP is the underlying transport protocol used by HTTP, which ensures that messages are delivered in the correct sequence. As opposed to using UDP, this enables the program to run without the need to add any additional dependability.
One of the main benefits of a layered design is this kind of dependency on other levels for certain tasks!
- TCP is connection-oriented, therefore in order to establish a connection with servers, a sequence of initial messages must be sent.
- The client and server start exchanging messages as soon as the connection is established and continue doing so until the connection is finally ended by sending a few terminating messages.
HTTP Connection Types
To know the basics of HTTP, we need to know about HTTP connections. It comes in two varieties,
- Persistent HTTP connections
- Non-persistent HTTP connections
TCP is used in these two types of HTTP connections differently. Let’s talk about each’s main benefits and drawbacks.
Multiple HTTP request-response pairs are generally sent and received throughout an HTTP session, requiring the same client and server to create and then terminate separate TCP connections for each pair. This is not effective.
In the future, Persistent HTTP was created, which made use of a single client-server TCP connection for all HTTP request-responses made throughout a session.
Usually, the server cuts off the connection if there have been no queries for a time. It is customizable how long the server will keep the connection open before closing it.
One TCP connection is used for each request in non-persistent HTTP connections. Let’s say a customer asks for a web page’s basic HTML file. What occurs is as follows,
- A TCP connection is started by the client with the server.
- The client contacts the server with an HTTP request.
- The server transmits the requested item after retrieving it from storage.
- The object, in this example an HTML file, is sent to the client. If the file contains references to more objects, repeat the above steps for each of them.
- The TCP connection is terminated by the server.
Three TCP messages must be exchanged back and forth between the client and server to maintain the TCP connection. Three TCP messages are also sent back and forth between the client and server when the connection is shut off.
This all covers the Basics of HTTP that one should know about.