[erlang-bugs] erlang:decode_packet/3 issues

Loïc Hoguin <>
Tue Aug 23 12:49:54 CEST 2011


Sorry if it has already been reported but I'd like to point to two
issues in erlang:decode_packet/3: one is a bug, the other just an
annoying limitation.

There is a bug in erlang:decode_packet/3 that happens when we have an
header name with a - following another. If we have an even number of -,
then the following character is lowercase, otherwise it's uppercase:

1> erlang:decode_packet(httph, <<"test-test: test\r\n\r\n">>, []).
2> erlang:decode_packet(httph, <<"test--test: test\r\n\r\n">>, []).
3> erlang:decode_packet(httph, <<"test---test: test\r\n\r\n">>, []).

The other issue comes when we have header names bigger than 20
characters in length. It's a bit low for some header names, for example

4> erlang:decode_packet(httph, <<"sec-websocket-version: 8\r\n\r\n">>, []).
5> erlang:decode_packet(httph, <<"sec-websocket-versio: 8\r\n\r\n">>, []).

It would be appreciated if that number could be increased at least a
little or be made configurable. Otherwise we end up having to write the
same code in our applications to handle the longer header names.

Loïc Hoguin

More information about the erlang-bugs mailing list