mochi/mochiweb — pull request #65 by vinoski (2011-10-28 02:17:05+00:00)
Title: fix handling of long HTTP header lines

Due to Erlang bug OTP-9389, the handling of HTTP request header lines
that exceed the size of the gen_tcp receive buffer is broken when
using {packet,http} and {packet,httph} modes.

Modify mochiweb to work around this bug by first using {packet,line}
mode instead to collect request header lines and then using
erlang:decode_packet to parse them. Using {packet,line} allows us to
avoid reading past the headers into the request body (if present),
since doing that would require us to carry the body data from the
header handling functions over into the body handling functions, which
could be a pretty intrusive and complicated change.

Also add regression unit tests that verify that long HTTP request
lines and long HTTP header lines are handled correctly.