Skip to content

Commit 5fded60

Browse files
committed
Fix warning, add error log on Other
It appears the test was originaly menat to work as the "Other" case would be hit, and then when hitting the Other case - the code would previously just loop round without adding a header. This is no longer the case (i.e. even if the original 'Other' handling is provided).
1 parent 7b08923 commit 5fded60

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/mochiweb_http.erl

+2
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ headers(Socket, Opts, Request, Headers, Body, HeaderCount) ->
136136
mochiweb_socket:close(Socket),
137137
exit(normal);
138138
Other ->
139+
error_logger:warning_msg("Got unexpected Message: ~w (to pid=~w)~n",
140+
[Other, self()]),
139141
handle_invalid_msg_request(Other, Socket, Opts, 400, Request, Headers)
140142
after ?HEADERS_RECV_TIMEOUT ->
141143
mochiweb_socket:close(Socket),

test/mochiweb_http_tests.erl

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ unexpected_msg_send(Server, MsgAt, Msg) ->
101101
gen_tcp:recv(S, 0, 5000).
102102

103103
invalid_header_send(Server, Msg) ->
104-
{S, Acceptor} = setup_server(Server),
104+
{S, _Acceptor} = setup_server(Server),
105105
gen_tcp:send(S, Msg),
106106
gen_tcp:recv(S, 0, 5000).
107107

0 commit comments

Comments
 (0)