From 2e3d4ea2bdb8515772a198a863575ddbd32fd09c Mon Sep 17 00:00:00 2001 From: Adam Kocoloski Date: Mon, 9 Nov 2009 20:17:51 +0000 Subject: wait 5 minutes before assuming a connection is stale git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@834212 13f79535-47bb-0310-9956-ffa450edef68 --- src/mochiweb/mochiweb_request.erl | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'src/mochiweb') diff --git a/src/mochiweb/mochiweb_request.erl b/src/mochiweb/mochiweb_request.erl index 64c4f58d..e8f0a67c 100644 --- a/src/mochiweb/mochiweb_request.erl +++ b/src/mochiweb/mochiweb_request.erl @@ -39,8 +39,8 @@ %% @type response(). A mochiweb_response parameterized module instance. %% @type ioheaders() = headers() | [{key(), value()}]. -% 10 second default idle timeout --define(IDLE_TIMEOUT, 10000). +% 5 minute default idle timeout +-define(IDLE_TIMEOUT, 300000). % Maximum recv_body() length of 1MB -define(MAX_RECV_BODY, (1024*1024)). @@ -451,14 +451,11 @@ stream_chunked_body(MaxChunkSize, Fun, FunState) -> stream_unchunked_body(0, _MaxChunkSize, Fun, FunState) -> Fun({0, <<>>}, FunState); -stream_unchunked_body(Length, MaxChunkSize, Fun, FunState) when Length > MaxChunkSize -> - Bin = recv(MaxChunkSize), - NewState = Fun({MaxChunkSize, Bin}, FunState), - stream_unchunked_body(Length - MaxChunkSize, MaxChunkSize, Fun, NewState); -stream_unchunked_body(Length, MaxChunkSize, Fun, FunState) -> - Bin = recv(Length), - NewState = Fun({Length, Bin}, FunState), - stream_unchunked_body(0, MaxChunkSize, Fun, NewState). +stream_unchunked_body(Length, _, Fun, FunState) when Length > 0 -> + Bin = recv(0), + BinSize = size(Bin), + NewState = Fun({BinSize, Bin}, FunState), + stream_unchunked_body(Length - BinSize, 0, Fun, NewState). %% @spec read_chunk_length() -> integer() -- cgit v1.2.3