You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ii...@apache.org on 2016/10/05 17:02:40 UTC

[1/2] chttpd commit: updated refs/heads/master to 53459ab

Repository: couchdb-chttpd
Updated Branches:
  refs/heads/master 297493f29 -> 53459aba5


Handle disconnect when receiving body

When any error happen on an underlying socket mochiweb uses
exit(normal). Add catch for exit:normal and convert it to
exit({bad_request, <<"Incomplete">>}).

COUCHDB-3158


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

Branch: refs/heads/master
Commit: 3868099565dbf8eb7851c50a2e2940f078aea14e
Parents: 297493f
Author: ILYA Khlopotov <ii...@apache.org>
Authored: Thu Sep 22 16:19:39 2016 -0700
Committer: ILYA Khlopotov <ii...@apache.org>
Committed: Wed Oct 5 09:30:28 2016 -0700

----------------------------------------------------------------------
 src/chttpd_external.erl | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/38680995/src/chttpd_external.erl
----------------------------------------------------------------------
diff --git a/src/chttpd_external.erl b/src/chttpd_external.erl
index ec3afaa..1dccf2a 100644
--- a/src/chttpd_external.erl
+++ b/src/chttpd_external.erl
@@ -94,7 +94,11 @@ json_req_obj_field(<<"headers">>, #httpd{mochi_req=Req}, _Db, _DocId) ->
     to_json_terms(Hlist);
 json_req_obj_field(<<"body">>, #httpd{req_body=undefined, mochi_req=Req}, _Db, _DocId) ->
     MaxSize = config:get_integer("couchdb", "max_document_size", 4294967296),
-    Req:recv_body(MaxSize);
+    try
+        Req:recv_body(MaxSize)
+    catch exit:normal ->
+        exit({bad_request, <<"Invalid request body">>})
+    end;
 json_req_obj_field(<<"body">>, #httpd{req_body=Body}, _Db, _DocId) ->
     Body;
 json_req_obj_field(<<"peer">>, #httpd{mochi_req=Req}, _Db, _DocId) ->


[2/2] chttpd commit: updated refs/heads/master to 53459ab

Posted by ii...@apache.org.
Merge remote branch 'cloudant:69425-handle-truncated-req-in-recv_body'

This closes #140

Signed-off-by: ILYA Khlopotov <ii...@apache.org>


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

Branch: refs/heads/master
Commit: 53459aba58df00281a631657e7deabf0a30828e3
Parents: 297493f 3868099
Author: ILYA Khlopotov <ii...@apache.org>
Authored: Wed Oct 5 10:01:49 2016 -0700
Committer: ILYA Khlopotov <ii...@apache.org>
Committed: Wed Oct 5 10:01:49 2016 -0700

----------------------------------------------------------------------
 src/chttpd_external.erl | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------