[erlang-bugs] Potential bug in {packet, http}

Colm Dougan colm.dougan@REDACTED
Sun Sep 20 00:14:06 CEST 2009


On Sat, Sep 19, 2009 at 10:13 PM, Steve Vinoski <vinoski@REDACTED> wrote:
>
>
> On Sat, Sep 19, 2009 at 4:51 PM, Colm Dougan <colm.dougan@REDACTED> wrote:
>>
>> HI,
>>
>> When I used erlang:decode_packet to parse a HTTP request with an
>> absolute URI I get the expected outcome :
>>
>> 1> erlang:decode_packet(http, <<"GET http://www.foo.com/bar
>> HTTP/1.0\r\n">>, []).
>> {ok,{http_request,'GET',
>>                  {absoluteURI,http,"www.foo.com",undefined,"/bar"},
>>                  {1,0}},
>>    <<>>}
>>
>> However, when I use {packet, http} for the same thing the outcome is
>> not what I expect :
>>
>> 1> my_httpd:start().
>> Listening on port: 8082
>> ok
>> 2> my_httpd:do_client(<<"GET http://www.foo.com/bar HTTP/1.0\r\n">>).
>> Connecting to localhost:8082 ...
>> Connected
>> ok
>> Method: 'GET', Uri: {absoluteURI,http,"www.foo.com",undefined,"/bar
>> HTTP/1"}, Version: {1, 0}
>>
>> The code of my_httpd is below.  Is this a bug or am I missing something?
>
> What version of Erlang are you using? I tried your code on R13B01 and it was
> just fine, but I see the same error you got when I use R12B-5.

Yeah I'm using 12B-5.  Before I posted I checked the 13B01 changes
file for anything that sounded like this but my search came up empty

However, now I've checked the 13A changes file I see this :

    OTP-7682  A bug fixed for TCP sockets with option {packet,http}.
	      An HTTP request with an absolute URI was returned with a
	      corrupt path string. This bug did only exist in R12B-4 and
	      R12B-5.

My bad (although IMO it would be nice if bugs fixed in a beta release
are mentioned in the next official release changes file).

Colm


More information about the erlang-bugs mailing list