module HTTP1
Nested
Definitions
TOKEN = /[!#$%&'*+\-\.\^_`|~0-9a-zA-Z]+/.freeze
HTTP/1.x request line parser:
FIELD_NAME = TOKEN
HTTP/1.x header parser:
FIELD_VALUE = /[^\0\r\n]+/.freeze
A field value is any string of characters that does not contain a null character, CR, or LF. After reflecting on the RFCs and surveying real implementations, I came to the conclusion that the RFCs are too restrictive. Most servers only check for the presence of null bytes, and obviously CR/LF characters have semantic meaning in the parser. So, I decided to follow this defacto standard, even if I'm not entirely happy with it.