nickva closed pull request #1403: A better fix for handling node local 413 
responses
URL: https://github.com/apache/couchdb/pull/1403
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/src/couch/src/couch_httpd.erl b/src/couch/src/couch_httpd.erl
index b4f01af9f9..1ec7096781 100644
--- a/src/couch/src/couch_httpd.erl
+++ b/src/couch/src/couch_httpd.erl
@@ -40,6 +40,8 @@
 
 
 -define(HANDLER_NAME_IN_MODULE_POS, 6).
+-define(MAX_DRAIN_BYTES, 1048576).
+-define(MAX_DRAIN_TIME_MSEC, 1000).
 
 start_link() ->
     start_link(http).
@@ -1181,10 +1183,9 @@ respond_(#httpd{mochi_req = MochiReq}, 413, Headers, 
Args, Type) ->
     % just increases the chances of 413 being detected correctly by the client
     % (rather than getting a brutal TCP reset).
     erlang:put(mochiweb_request_force_close, true),
-    Socket = MochiReq:get(socket),
-    mochiweb_socket:recv(Socket, 0, 0),
     Result = MochiReq:Type({413, Headers, Args}),
-    mochiweb_socket:recv(Socket, 0, 0),
+    Socket = MochiReq:get(socket),
+    mochiweb_socket:recv(Socket, ?MAX_DRAIN_BYTES, ?MAX_DRAIN_TIME_MSEC),
     Result;
 respond_(#httpd{mochi_req = MochiReq}, Code, Headers, Args, Type) ->
     MochiReq:Type({Code, Headers, Args}).


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to