Skip to content

Commit

Permalink
Merge pull request #161 from cloudant/leave-other-messages
Browse files Browse the repository at this point in the history
Don't swallow 'other' messages
  • Loading branch information
etrepum committed Sep 9, 2015
2 parents 952087e + 61a65fe commit decb075
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/mochiweb_http.erl
Expand Up @@ -99,9 +99,7 @@ request(Socket, Opts, Body) ->
exit(normal);
{ssl_closed, _} ->
mochiweb_socket:close(Socket),
exit(normal);
Other ->
handle_invalid_msg_request(Other, Socket, Opts)
exit(normal)
after ?REQUEST_RECV_TIMEOUT ->
mochiweb_socket:close(Socket),
exit(normal)
Expand Down Expand Up @@ -129,7 +127,7 @@ headers(Socket, Opts, Request, Headers, Body, HeaderCount) ->
{tcp_closed, _} ->
mochiweb_socket:close(Socket),
exit(normal);
Other ->
{tcp_error, _, emsgsize} = Other ->
handle_invalid_msg_request(Other, Socket, Opts, Request, Headers)
after ?HEADERS_RECV_TIMEOUT ->
mochiweb_socket:close(Socket),
Expand All @@ -143,10 +141,6 @@ call_body({M, F}, Req) ->
call_body(Body, Req) ->
Body(Req).

-spec handle_invalid_msg_request(term(), term(), term()) -> no_return().
handle_invalid_msg_request(Msg, Socket, Opts) ->
handle_invalid_msg_request(Msg, Socket, Opts, {'GET', {abs_path, "/"}, {0,9}}, []).

-spec handle_invalid_msg_request(term(), term(), term(), term(), term()) -> no_return().
handle_invalid_msg_request(Msg, Socket, Opts, Request, RevHeaders) ->
case {Msg, r15b_workaround()} of
Expand Down

0 comments on commit decb075

Please sign in to comment.