[erlang-bugs] Inets-5.9.3 Content-length:0 HTTP/1.1 Bug
Anton Nikitin
niticin@REDACTED
Mon Feb 11 16:20:47 CET 2013
Hello,
I'm facing the following issue, when executing the following code with inets-5.9.3:
inets:start().
F =
fun() ->
io:format("Started thread~n"),
[
begin
io:format("Response ~p~n", [httpc:request('get', {"http://nikitin.reksoft.ru:7080/TestErlang/testerlang", []}, [{version, "HTTP/1.1"}], [])]),
timer:sleep(1000)
end || _ <- lists:seq(1, 5)] end.
[spawn(F) || _ <- lists:seq(1, 500)].
According to the TCP traces everything is fine.
The HTTP/1.1 request:
GET /TestErlang/testerlang HTTP/1.1
te:
host: nikitin.reksoft.ru:7080
connection: keep-alive
The HTTP/1.1 response:
HTTP/1.1 404 Not Found
Server: Apache-Coyote/1.1
Content-Type: text/plain
Content-Length: 0
Date: Mon, 11 Feb 2013 15:15:31 GMT
But some of the reponses are formed wrongly in this way:
Response {ok,{{"HTTP/1.1",404,"Not Found"},
[{"date","Mon, 11 Feb 2013 15:16:19 GMT"},
{"server","Apache-Coyote/1.1"},
{"content-length","0"},
{"content-type","text/plain"}],
"HTTP/1.1 404 Not Found\r\nServer: Apache-Coyote/1.1\r\nContent-Type: text/plain\r\nContent-Length: 0\r\nDate: Mon, 11 Feb 2013 15:16:19 GMT\r\n\r\nHTTP/1.1 404 Not Found\r\nServer: Apache-Coyote/1.1\r\nContent-Type: text/plain\r\nContent-Length: 0\r\nDate: Mon, 11 Feb 2013 15:16:19 GMT\r\n\r\n"}}
The bug can be reproduced in a multi-thread case only. Workaround: HTTP/1.1 server responds with some content body and content length is not zero.
Best Regards,
Anton Nikitin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20130211/394da1ea/attachment.htm>
More information about the erlang-bugs
mailing list