HTTP

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).

Semantics

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:

HTTP/1.0

HTTP/1.0 has one request and response for every TCP connection.

HTTP/1.1

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.


  1. https://www.rfc-editor.org/rfc/rfc9110#section-5.3-4.1↩︎

  2. https://www.rfc-editor.org/rfc/rfc9112.html#name-chunked-transfer-coding↩︎

  3. https://www.rfc-editor.org/rfc/rfc9112.html#name-persistence↩︎

  4. https://www.rfc-editor.org/rfc/rfc9112.html#section-6.3-4.1↩︎