Weird problem when using tcp sockets in HTTP mode

Mihai Balea <>
Fri Jul 17 23:22:40 CEST 2009

Hi all,

I'm hitting a weird problem and I'm wondering if it is a bug somewhere  
in the system libs.

I'm running R13B01. I am opening a tcp socket in http mode and  
apparently the HttpUri returned by gen_tcp:recv contains only the  
first key-value pair of the query string.

Here's the code I'm running:


run() ->
     {ok, LS} = gen_tcp:listen(6969, [{packet, http}, {active, false},  
{reuseaddr, true}, list]),
     {ok, S} = gen_tcp:accept(LS),

do_recv(S) ->
     {ok, Packet} = gen_tcp:recv(S, 0),
     io:format("~p\n", [Packet]),

Here's the query:
curl -v http://localhost:6969/foo/bar?a=1&b=2&c=3

And the output of the program:
3> h:run().
              "curl/7.19.5 (i386-apple-darwin9.7.0) libcurl/7.19.5  

Am I doing something wrong or is this indeed a bug?


More information about the erlang-questions mailing list