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

Steve Vinoski vinoski@REDACTED
Sat Sep 19 23:13:00 CEST 2009


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.

--steve


More information about the erlang-bugs mailing list