HTTP/HTTP/TCP
HTTP (HTTP), or Hypertext Transfer Protocol, is a foundational protocol used for transferring data over the internet, primarily for web content. The term "HTTP/HTTP/TCP" refers to the layered architecture through which web data travels:
- HTTP - This layer handles the request and response between client and server, defining how messages are formatted, transmitted, and interpreted.
- TCP - Transmission Control Protocol lies beneath HTTP and ensures reliable, ordered, and error-checked delivery of a stream of bytes between applications running on hosts communicating via an IP network.
History and Context
HTTP was developed by Tim Berners-Lee at CERN in 1989 to enable the distribution of hypertext documents over the Internet. The initial version of HTTP was HTTP/0.9, which was quite simple and supported only basic GET requests. Here's how HTTP evolved:
- HTTP/1.0 (1996) - This version introduced headers, status codes, and more methods like POST, HEAD, and DELETE. It was defined in RFC 1945.
- HTTP/1.1 (1997) - Defined in RFC 2068 (later updated by RFC 2616), it introduced persistent connections (keep-alive), pipelining, and improved caching mechanisms.
- HTTP/2 (2015) - As outlined in RFC 7540, HTTP/2 brought significant improvements in performance by introducing binary framing, header compression, and multiplexing.
- HTTP/3 (draft) - HTTP/3 uses QUIC instead of TCP, aiming to reduce latency and improve security.
The relationship with TCP:
- TCP was designed to provide reliable, ordered, and error-checked delivery of a stream of bytes between applications. When HTTP communicates over TCP, it uses:
- Port 80 for HTTP and Port 443 for HTTPS (HTTP Secure), which uses SSL/TLS over TCP for secure communication.
- TCP establishes a connection through a three-way handshake before HTTP requests can be sent, ensuring that data packets are delivered in sequence and without loss.
How HTTP Works with TCP
When a user requests a web page:
- The client (usually a web browser) sends an HTTP request to the server's IP address on port 80 or 443.
- This request is encapsulated within a TCP packet, which includes:
- Source and destination port numbers.
- Sequence and acknowledgment numbers for data ordering and reliability.
- Checksums for error checking.
- The server receives this TCP packet, processes the HTTP request, and sends back an HTTP response within a TCP packet.
- The client acknowledges receipt of the data, and the TCP connection is closed unless keep-alive is enabled.
Sources:
Related Topics: