[erlang-questions] [bug?] R12B-4 HTTP header parsing

Sverker Eriksson sverker@REDACTED
Mon Sep 8 14:34:14 CEST 2008


igwan wrote:
> While testing the new erlang:decode_packet/3 I found it returns 
> http_error for inputs that are allowed by RFC2616 :
>   
:
> 2> erlang:decode_packet(httph,<<"Host : erlang.org:80\r\n\r\n">>,[]).
> {ok,{http_error,"Host : erlang.org:80\r\n"},<<"\r\n">>}
>
> (i.e. just adding a space between the field-name and the ':' separator)
>   

This seems be to an old bug in the http-parsing for sockets that was 
reused for erlang:decode_packet.

Inserting this in erts/emulator/beam/packet_parser.c line 791 would fix 
it (not tested yet):
        }
+        while (n && SP(ptr)) {
+            ptr++; n--;
+        }
        if (*ptr != ':') {

I will fix it for next release.

Thanks
/Sverker, Erlang/OTP Ericsson




More information about the erlang-questions mailing list