Skip to content
This repository was archived by the owner on Sep 10, 2019. It is now read-only.

Parse headers to spec #12

Open
sleepdeprecation opened this issue Sep 12, 2013 · 0 comments
Open

Parse headers to spec #12

sleepdeprecation opened this issue Sep 12, 2013 · 0 comments

Comments

@sleepdeprecation
Copy link
Owner

According to the spec, headers can have any number of spaces or tabs following the colon (but not before it).

Also, they can be spread across multiple lines, provided the following lines start with spaces or tabs.

From RFC 2616 sec4.2

HTTP header fields, which include general-header (section 4.5), request-header (section 5.3), response-header (section 6.2), and entity-header (section 7.1) fields, follow the same generic format as that given in Section 3.1 of RFC 822 [9]. Each header field consists of a name followed by a colon (":") and the field value. Field names are case-insensitive. The field value MAY be preceded by any amount of LWS, though a single SP is preferred. Header fields can be extended over multiple lines by preceding each extra line with at least one SP or HT. Applications ought to follow "common form", where one is known or indicated, when generating HTTP constructs, since there might exist some implementations that fail to accept anything

beyond the common forms.

  message-header = field-name ":" [ field-value ]
  field-name     = token
  field-value    = *( field-content | LWS )
  field-content  = <the OCTETs making up the field-value
                   and consisting of either *TEXT or combinations
                   of token, separators, and quoted-string>

LWS is a space or tab character according to RFC 822

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant