Return-Path: X-Original-To: apmail-couchdb-commits-archive@www.apache.org Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0F76A1819D for ; Mon, 20 Jul 2015 21:15:55 +0000 (UTC) Received: (qmail 61500 invoked by uid 500); 20 Jul 2015 21:15:43 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 61451 invoked by uid 500); 20 Jul 2015 21:15:43 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 61442 invoked by uid 99); 20 Jul 2015 21:15:43 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Jul 2015 21:15:43 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 958F5E0F7C; Mon, 20 Jul 2015 21:15:43 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: kocolosk@apache.org To: commits@couchdb.apache.org Message-Id: <76b48e21c3e74325b17ed21f613e14b2@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: chttpd commit: updated refs/heads/2724-chunked-buffering to 0ffc16d Date: Mon, 20 Jul 2015 21:15:43 +0000 (UTC) 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 Authored: Mon Jul 20 17:10:10 2015 -0400 Committer: Adam Kocoloski 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}};