couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kocol...@apache.org
Subject chttpd commit: updated refs/heads/2724-chunked-buffering to 0ffc16d
Date Mon, 20 Jul 2015 21:15:43 GMT
Repository: couchdb-chttpd
Updated Branches:
  refs/heads/2724-chunked-buffering f6097cdce -> 0ffc16d0d (forced update)


Guard against flushing an empty buffer

If the threshold is set below the size of an individual row we
effectively disable buffering. In that case we need to make sure not to
try and flush an empty buffer, as that's exactly the syntax for
terminating a chunked response.


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

Branch: refs/heads/2724-chunked-buffering
Commit: 0ffc16d0db1e72cac7134e8f05b8b460e314ac46
Parents: f73ddaf
Author: Adam Kocoloski <adam@cloudant.com>
Authored: Mon Jul 20 17:10:10 2015 -0400
Committer: Adam Kocoloski <adam@cloudant.com>
Committed: Mon Jul 20 17:15:37 2015 -0400

----------------------------------------------------------------------
 src/chttpd_db.erl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/0ffc16d0/src/chttpd_db.erl
----------------------------------------------------------------------
diff --git a/src/chttpd_db.erl b/src/chttpd_db.erl
index 4217d4a..d8327b1 100644
--- a/src/chttpd_db.erl
+++ b/src/chttpd_db.erl
@@ -218,7 +218,7 @@ changes_callback({error, Reason}, Acc) ->
     chttpd:send_delayed_error(Acc#cacc.mochi, Reason).
 
 maybe_flush_changes_feed(#cacc{bufsize=Size, threshold=Max} = Acc, Data, Len)
-         when (Size + Len) > Max ->
+         when Size > 0 andalso (Size + Len) > Max ->
     #cacc{buffer = Buffer, mochi = Resp} = Acc,
     {ok, R1} = chttpd:send_delayed_chunk(Resp, Buffer),
     {ok, Acc#cacc{prepend = ",\r\n", buffer = Data, bufsize=Len, mochi = R1}};


Mime
View raw message