benoitc/http-parser — pull request #40 by acg (2013-07-18 01:05:41+00:00)
Title: Handle continuation HTTP headers correctly

Currently, `http_parser.parser` joins continued header values together as a comma-separated list. According to the [RFC](http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2) continuation lines should instead be joined with a single space:

> Any LWS that occurs between field-content MAY be replaced with a single SP before interpreting the field value or forwarding the message downstream.

If a header name is repeated, the values *can* be folded together into a comma-separated list. The current code handles this correctly.

But in either case, if the header value so far is empty, I don't think we should prepend the separator. So this:

X-Test:
X-Test: foo
X-Test: bar

Should be equivalent to

X-Test: foo, bar

Not

X-Test: , foo, bar

I've also attached a couple test suite functions for the continuation and repeated header cases.