link: Web Communication Protocols
HTTP (Hypertext Transfer Protocol)
Overview
HTTP, the Hypertext Transfer Protocol, is a cornerstone of the web, facilitating distributed, collaborative, hypermedia information systems. It forms the backbone of data exchange on the World Wide Web, allowing communication between web clients (e.g., browsers) and servers.
HTTP operates within the Client-Server Model, characterized by clients requesting resources and servers responding with data. Notably, HTTP is stateless, meaning each transaction is independent, enhancing web scalability and performance.
Key Features and Functions
HTTP’s functionality revolves around several key components:
- Request-Response Model: This basic model of HTTP involves clients sending requests and servers sending back responses.
- URI (Uniform Resource Identifier): URIs uniquely identify resources on the web, allowing clients to pinpoint and retrieve different resources.
- HTTP Methods: Methods like GET, POST, PUT, and DELETE define the type of action the client wants to perform on the resource.
- HTTP Status Codes: These codes provide feedback from the server about the result of the requested action, such as 200 for success or 404 for not found.
- Header Fields: Both requests and responses feature headers that carry metadata such as content type, content length, and caching directives.
- Statelessness: The protocol does not remember previous interactions, which simplifies the server architecture.
How HTTP Works
Understanding the HTTP Flow:
- Client Sends Request: A client, like a web browser, sends an HTTP request to the server. This includes the HTTP method, the URI for the resource, and headers with additional metadata.
- Server Processes Request: The server interprets the request, performs the necessary actions such as retrieving or modifying resources, and prepares a response.
- Server Sends Response: The response, containing the status of the operation and any requested data, is sent back to the client.
- Client Receives Response: Upon receiving the response, the client processes the information, possibly rendering it (e.g., displaying a web page).
- Completion of Transaction: With the response received, the transaction completes, ready for the client to initiate further actions if necessary.
HTTP Versions
HTTP Versions
Overview
HTTP, or Hypertext Transfer Protocol, has seen several iterations, each bringing advancements in performance, security, and functionality. Here’s a brief overview of key versions:
HTTP 1.1: Introduced persistent connections, pipelining, and chunked transfer encoding, enhancing efficiency.
HTTP 2.0: Introduced multiplexing, header compression, and server push, significantly improving speed and performance.
HTTP 3.0: Utilizes the QUIC Protocol transport protocol over UDP for reduced latency and improved security compared to TCP-based protocols.
HTTPS: Not a separate version but an extension that adds encryption to HTTP, ensuring secure data transmission over the internet.
Understanding these versions and their differences is essential for optimizing web performance and ensuring secure communication between clients and servers.
Version Comparison
Feature HTTP 1.0 HTTP 1.1 HTTP/2 HTTP/3 Multiplexing No No Yes Yes Header Compression No No Yes Yes Server Push No No Yes Yes (with server support) Persistent Connections No Yes Yes Yes Connection Reuse No Yes Yes Yes Stream Prioritization No No Yes Yes Encryption No No Yes (over TLS) Yes (over [[QUIC Protocol Latency Higher Lower Lower Lower Protocol HTTP HTTP Binary framing layer over TCP/TLS Datagram-based protocol over UDP Overhead Higher Lower Lower Lower Compatibility Older Widely used Widely supported Emerging History Of Each Version
Link to originalHistory
HTTP 1.0 was finalized and fully documented in 1996. Every request to the same server requires a separate TCP connection.
HTTP 1.1 was published in 1997. A TCP connection can be left open for reuse (persistent connection), but it doesn’t solve the HOL (head-of-line) blocking issue. HOL blocking - when the number of allowed parallel requests in the browser is used up, subsequent requests need to wait for the former ones to complete.
HTTP 2.0 was published in 2015. It addresses HOL issue through request multiplexing, which eliminates HOL blocking at the application layer, but HOL still exists at the transport (TCP) layer. As you can see in the diagram, HTTP 2.0 introduced the concept of HTTP “streams”: an abstraction that allows multiplexing different HTTP exchanges onto the same TCP connection. Each stream doesn’t need to be sent in order.
HTTP 3.0 first draft was published in 2020. It is the proposed successor to HTTP 2.0. It uses QUIC instead of TCP for the underlying transport protocol, thus removing HOL blocking in the transport layer.
Conclusion
HTTP is essential for the functioning of the World Wide Web, facilitating a structured and efficient exchange of data between clients and servers. Its methodical framework, characterized by a robust request-response model and clear protocols for managing transactions, is fundamental for web developers and network communication specialists.
References
HTTP1 vs HTTP2 vs HTTP3 - A Deep Dive The Foundation of REST API: HTTP - ByteByteGo Newsletter