httpstandards-compliance

Newlines in HTTP


The HTTP 1.1 standard says that newlines are CRLF. However wget, lynx, and firefox, all accepts a response in UNIX format.

Is it acceptable for a HTTP parser to simply skip all carriage returns in the header?


Solution

  • From RFC 9112, section 2.2:

    Although the line terminator for the start-line and fields is the sequence CRLF, a recipient MAY recognize a single LF as a line terminator and ignore any preceding CR.

    If you were to build a recipient (client or server), it would be RFC compliant to parse requests that only send an LF as line terminator.