2023-10-24
HTTP is an text based interchange format with a lot of... history. It is currently specified in RFC9110 for general semantics. The next few RFCs define various other aspects (i.e.: HTTP/1.1 is RFC9112).
In general, a request-response pair follows the same pattern:
GET /path?query#fragment HTTP/1.1
Field1: abc, def
Field2: xyz
Field1: uvw
HTTP/1.1 200 OK
Field3: abc, def
Field2: xyz
Field3: uvw
Transfer-Encoding: chunked
32
Hello, world!
This is a request.
0
Notably, this used:
Set-Cookie
), so it it
safest to store the values separately1.HTTP/1.0 has one request and response for every TCP connection.
HTTP/1.1 can have more than one request and response for every TCP
connection. The end of a request message is identified by either a
Content-Length
header,
Transfer-Encoding: chunked
and a terminating, zero-length
chunk, or immediately following the headers4.