ocaml-cohttp
ocaml-cohttp copied to clipboard
cohttp(client): Host header field should be the first header field
From https://www.rfc-editor.org/rfc/rfc9110#section-7.2
A user agent that sends Host SHOULD send it as the first field in the header section of a request. For example, a GET >request to the origin server for http://www.example.org/pub/WWW/ would begin with:
GET /pub/WWW/ HTTP/1.1 Host: www.example.org
It says should, not must, though
It says should, not must, though
Indeed. According to RFC 2119 "SHOULD" = "recommended best practice".
SHOULD This word, or the adjective "RECOMMENDED", mean that there may exist valid reasons in particular circumstances to ignore a particular item, but the full implications must be understood and carefully weighed before choosing a different course.
I haven't found a counter explanation to not do it as per the spec.