[erlang-questions] weird http parsing

Andy W. Song wsongcn@REDACTED
Mon Jul 25 18:15:10 CEST 2011


I'm using inet:setopts(Sock, [{active,true},{packet, http}]) to receive http
packets. I found that Erlang silently modifies some http header name fields
from like "Sec-WebSocket-Origin" to "Sec-Websocket-Origin". But another
fields "Sec-WebSocket-Version" is not modified. It's quite strange.

I know http header field name is case insensitive but Erlang should not
silently and inconsistently modify it.

After I found it I tried to use all lower case. But  "erlang:decode_packet"
decodes some of the fields into atoms and other not-recognized ones to
string so it's quite inconvenient to use all lower case.

Any ideas to mitigate this?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110726/f6a000bf/attachment.htm>

More information about the erlang-questions mailing list