kernelsauce / turbo

Turbo is a framework built for LuaJIT 2 to simplify the task of building fast and scalable network applications. It uses a event-driven, non-blocking, no thread design to deliver excellent performance and minimal footprint to high-load applications while also providing excellent support for embedded uses.
http://turbo.readthedocs.io/
Apache License 2.0
528 stars 84 forks source link

Case sensitive header fields #235

Closed mvitez closed 9 years ago

mvitez commented 9 years ago

First of all thank you for this library. I just wanted to inform you of this problem:

Header fields names like "Content-Type" or "Content-Length" are searched by Turbo with case-sensitive comparison, which is wrong (RFC2616 / 4.2), so turbo does not work with other libraries, like e.g. node request, which sends "content-type" instead of "Content-Type".

kernelsauce commented 9 years ago

If that is indeed the case then it is a bug. It is supposed to support any case... I will look at it.

mvitez commented 9 years ago

Ok, thank you. I solved this problem by simply changing the default behaviour of httputil.HTTPParser:get:

Line 304 of httputil.lua becomes if caseinsensitive == nil or caseinsensitive then instead of if caseinsensitive then

kernelsauce commented 9 years ago

That would do the trick ;). I'm going to review what would the best solution. I thought all places where we get headers were done case insensitive already...

kernelsauce commented 9 years ago

Now available on LuaRocks as v2.0.2.