-
Notifications
You must be signed in to change notification settings - Fork 473
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #107 from djnym/gen_tcp_fix
Make the acceptor crash optional.
- Loading branch information
Showing
4 changed files
with
44 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env escript | ||
%% -*- mode: erlang -*- | ||
%%! -pa ../ebin | ||
-export([main/1]). | ||
|
||
main([]) -> | ||
application:start (inets), | ||
mochiweb_http:start([{port, 5678}, | ||
{loop, | ||
fun(Req) -> | ||
Req:respond({ 200, | ||
[ {"Content-Type", "text/html"} ], | ||
[ "<html><body>Hello</body></html>" ] | ||
}) | ||
end}]), | ||
|
||
io:format ("~p~n",[not has_bug(1000) and not has_bug(10000)]). | ||
|
||
has_bug (Len) -> | ||
case | ||
httpc:request (get, {"http://127.0.0.1:5678/", | ||
[{"X-Random", [$a || _ <- lists:seq(1,Len)]}]}, [], []) | ||
of | ||
{error,socket_closed_remotely} -> true; | ||
{ok,{{"HTTP/1.1",200,"OK"}, _, "<html><body>Hello</body></html>"}} -> false; | ||
{ok,{{"HTTP/1.1",400,"Bad Request"}, _, []}} -> false; | ||
R -> io:format ("don't know what to make of ~p~n",[R]), undefined | ||
end. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters