-
Notifications
You must be signed in to change notification settings - Fork 93
Open
Description
1. Run simplistic misultin http server, like this
#!/usr/bin/env escript
%%! -smp disable +A1 +K true -pz ./ebin -pa deps/misultin/ebin -input
-module(misultin_ws_close_bug).
-mode(compile).
-export([main/1]).
main(_) ->
Port = 8000,
io:format(" [*] Running at http://localhost:~p~n", [Port]),
misultin:start_link([{port, Port}, {autoexit, false},
{loop, fun (Req) -> handle_http(Req) end}]),
receive
_ -> ok
end.
handle_http(Req) ->
Req:respond(404, <<"404 - Nothing here\n">>).
2. Run curl:
curl -v localhost:8000 -X POST
Result:
< HTTP/1.1 400 Bad Request
< Content-Length: 49
< Connection: Close
<
<h1>400 Bad Request</h1>
Logs say:
=ERROR REPORT==== 10-Feb-2012::17:30:18 ===
module: misultin_http
line: 392
error reading body: no_valid_content_specs
=ERROR REPORT==== 10-Feb-2012::17:30:18 ===
module: misultin_http
line: 371
tcp error treating post data: no_valid_content_specs, send bad request error back
3. Run curl with Content-Length set to 0:
curl -v localhost:8000 -X POST -H "Content-Length: 0"
Result:
< HTTP/1.1 404 Not Found
< Date: Fri, 10 Feb 2012 17:31:00 GMT
< Server: misultin/0.9
< Connection: Keep-Alive
< Content-Length: 19
<
404 - Nothing here
Ie: Misultin crashes when POST is without content-length. I think it is reasonable to assume that when content-length is not present, no content will be sent. This is what other servers do.
Metadata
Metadata
Assignees
Labels
No labels