[erlang-questions] Weird problem when using tcp sockets in HTTP mode
Mihai Balea
mihai@REDACTED
Sat Jul 18 15:20:56 CEST 2009
Steve, Ruslan and Christian:
Obviously, you guys are right.
Quoting the URI solves the problem.
Sorry for the false alarm and thanks for helping me out
Mihai
PS: I guess I shouldn't attempt to figure out bugs late on a friday
evening :)
On Jul 17, 2009, at 5:22 PM, Mihai Balea wrote:
> 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:
>
> -module(h).
> -compile(export_all).
>
> run() ->
> {ok, LS} = gen_tcp:listen(6969, [{packet, http}, {active, false},
> {reuseaddr, true}, list]),
> {ok, S} = gen_tcp:accept(LS),
> do_recv(S).
>
> do_recv(S) ->
> {ok, Packet} = gen_tcp:recv(S, 0),
> io:format("~p\n", [Packet]),
> do_recv(S).
>
> 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().
> {http_request,'GET',{abs_path,"/foo/bar?a=1"},{1,1}}
> {http_header,24,'User-Agent',undefined,
> "curl/7.19.5 (i386-apple-darwin9.7.0) libcurl/7.19.5
> zlib/1.2.3"}
> {http_header,14,'Host',undefined,"localhost:6969"}
> {http_header,8,'Accept',undefined,"*/*"}
> http_eoh
>
> Am I doing something wrong or is this indeed a bug?
>
> Thanks,
> Mihai
>
>
> ________________________________________________________________
> erlang-questions mailing list. See http://www.erlang.org/faq.html
> erlang-questions (at) erlang.org
More information about the erlang-questions
mailing list