HTTP Fundamentals
1Introduction
This lecture explains the semantics of
2Resources and Representations
A
A
In HTTP, a
3Request and Response Semantics
Conceptually, an HTTP request contains the following elements:
- a
method , which specifies the requested semantics for the resource; - a
request target , which identifies the target of the operation; fields , which convey metadata concerning representation formats, authentication, caching, and other matters; and- optional
content , which conveys a representation to be processed when required.
An HTTP response contains a
4An HTTP/1.1 Message Example
HTTP/1.1 represents the start line and fields as text. The following request line is a GET request whose request target is /index.html.
GET /index.html HTTP/1.1
Host: example.com
Accept: text/html
The response start line contains the HTTP version, status code, and reason phrase.
HTTP/1.1 200 OK
Content-Type: text/html
This textual format is an HTTP/1.1 representation. HTTP/2 and HTTP/3 do not use request lines; they encode HTTP semantics in binary frames.
5Method Properties
6Status Codes
The first digit of a status code classifies the processing result as follows:
1xx: informational responses;2xx: successful responses;3xx: redirection messages;4xx: client errors; and5xx: server errors.
200 OK indicates that the request succeeded. 404 Not Found indicates that the server cannot find a current representation for the target resource or is unwilling to disclose that one exists. A 404 response alone therefore does not prove that the resource will never exist.
7HTTPS and TLS
8HTTP Versions and Transport
| Version | Primary underlying transport | HTTP message representation |
|---|---|---|
| HTTP/1.1 | TCP | Textual start lines and fields |
| HTTP/2 | TCP | Binary frames and multiplexing |
| HTTP/3 | QUIC over UDP | Binary frames and multiplexing over QUIC streams |
HTTP semantics such as resources, methods, and status codes are largely common across these versions. Their encodings and underlying transports differ, however. HTTP does not therefore always use TCP.
9Relationship to DNS and Lower Layers
In a typical web access whose URL contains a domain name, a client resolves the name through DNS, connects to a selected IP address, and sends an HTTP request. DNS is not part of HTTP semantics, however, and a client may instead use a cached result or an IP address directly.
IP forwards packets toward their destination. TCP or QUIC provides functions that carry HTTP messages. Above them, HTTP defines the semantics of requests and responses concerning resources.
10Key Points
- HTTP defines request and response semantics for resources identified by URIs.
- A method specifies request semantics, while a status code classifies the processing result.
- HTTPS protects HTTP with TLS. HTTP/1.1 and HTTP/2 normally use TCP, whereas HTTP/3 uses QUIC.