HTTP/1.1 makes the Host header mandatory - it is how one server tells apart the many sites it may host. Today you reject a 1.1 request that omits it, the first real protocol rule your parser enforces.
Report an error when an HTTP/1.1 request has no Host header, and accept it when Host is present.
HTTP/1.1 introduced virtual hosting: one IP address and port can serve many
different websites, and the Host header is how the client says which one it
wants. Because of that the spec makes Host mandatory for 1.1 — a request
without it is malformed, no matter how well-formed everything else is.
This is your parser’s first semantic rule, as opposed to pure syntax. Checking it
now means the server can answer a hostless request with a clean 400 later
instead of guessing. Lean on the case-insensitive Get you just built — clients
capitalize Host every possible way.
if version == "HTTP/1.1" && headers.Get("Host") == "" {return errors.New("missing Host header")}