You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2017/08/14 15:38:38 UTC

[28/31] mochiweb commit: updated refs/heads/upstream to 23dc119

Send 400 Bad Request if request line exceeds recbuf (#191)

I broke this back in 61a65fea7d6b1e9f93c4a2c6b96e96dee02bec6e. :/

Project: http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/commit/a6fdb9a3
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/tree/a6fdb9a3
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/diff/a6fdb9a3

Branch: refs/heads/upstream
Commit: a6fdb9a3af1301c8be68cd1f85a87ce3028da07a
Parents: b78a262
Author: Robert Newson <rn...@apache.org>
Authored: Sun Aug 13 00:28:12 2017 +0100
Committer: Bob Ippolito <bo...@redivi.com>
Committed: Sat Aug 12 16:28:12 2017 -0700

----------------------------------------------------------------------
 src/mochiweb_http.erl | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/blob/a6fdb9a3/src/mochiweb_http.erl
----------------------------------------------------------------------
diff --git a/src/mochiweb_http.erl b/src/mochiweb_http.erl
index 568019f..3b02065 100644
--- a/src/mochiweb_http.erl
+++ b/src/mochiweb_http.erl
@@ -97,6 +97,8 @@ request(Socket, Opts, Body) ->
         {tcp_closed, _} ->
             mochiweb_socket:close(Socket),
             exit(normal);
+        {tcp_error, _, emsgsize} = Other ->
+            handle_invalid_msg_request(Other, Socket, Opts);
         {ssl_closed, _} ->
             mochiweb_socket:close(Socket),
             exit(normal)
@@ -141,6 +143,10 @@ 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