case insensitive http headers
authorAndy Green <andy.green@linaro.org>
Wed, 13 Nov 2013 00:03:05 +0000 (08:03 +0800)
committerAndy Green <andy.green@linaro.org>
Wed, 13 Nov 2013 00:03:05 +0000 (08:03 +0800)
commit909a3720c7676303f38feda308f24fd63e7ce36b
treebaff48703152125738b71c9e53a10773c3aeb2ec
parent1e3f7b8de914eb3fb8d0e1b24ce8453f13736b18
case insensitive http headers

Svetlin wrote on github

According to RFC2616, all header field names in both HTTP requests and HTTP responses are case-insensitive. But libwebsockets uses a case-sensitive compare.

Reproduce:
Run libwebsockets against a server that sends all of its HTTP header field names in lower-case (for example: https://github.com/extend/cowboy). libwebsockets reports an error. The expected behavior is no errors reported and a successful handshake procedure.

This changes the parser reference table in minilex to all lower case.

The code to walk the parser tables then just forces a tolower on the incoming chars.

This (and minilex tables) only applies to header names.

Reported-by: svetlin-mladnov <?@github>
Signed-off-by: Andy Green <andy.green@linaro.org>
lib/lextable.h
lib/minilex.c
lib/parsers.c