essen/cowboy — pull request #1 by bgentry (2013-05-05 19:44:51+00:00)
Title: zero-length header names MUST issue a stream error

Hi Loïc,

I saw that you posted your early progress on SPDY in Cowboy. Thought I'd start by contributing a small piece.

Section [2.6.10](http://www.chromium.org/spdy/spdy-protocol/spdy-protocol-draft3#TOC-2.6.10-Name-Value-Header-Block) states:

> Each header name must have at least one value. Header names are encoded using the US-ASCII character set [ASCII] and must be all lower case. The length of each name must be greater than zero. A recipient of a zero-length name MUST issue a stream error (Section 2.4.2) with the status code PROTOCOL_ERROR for the stream-id.

So I've made the case of a zero-length header name do just that.

The spec isn't entirely clear what's supposed to happen in the case of a non-lowercase-ascii header name, though the spdy-dev mailing list and other implementations seem to suggest that those should also be a stream error. Anyway, we can handle that case later.

I'm not sure if/how you'd prefer to unit test things like this, so I'd appreciate some feedback on that.