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 A95E718A2E for ; Wed, 4 Nov 2015 22:29:09 +0000 (UTC) Received: (qmail 98493 invoked by uid 500); 4 Nov 2015 22:29:09 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 98447 invoked by uid 500); 4 Nov 2015 22:29:09 -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 98438 invoked by uid 99); 4 Nov 2015 22:29:09 -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; Wed, 04 Nov 2015 22:29:09 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 64D9DDFCE4; Wed, 4 Nov 2015 22:29:09 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: klaus_trainer@apache.org To: commits@couchdb.apache.org Message-Id: <7ccbbd46bc91432b95b3a3bd5aa0ea93@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: chttpd commit: updated refs/heads/master to a57e869 Date: Wed, 4 Nov 2015 22:29:09 +0000 (UTC) Repository: couchdb-chttpd Updated Branches: refs/heads/master e5b1aee90 -> a57e86994 Fix return types of responses to view requests This fixes an issue that was introduced with 72258e2 and e5b1aee. Background: Although all things still seemed to work, each request to a view generated an exception with the following stack trace: ``` exception error: undefined function vacc:get/2 in function chttpd:result/2 (src/chttpd.erl, line 297) in call from chttpd:handle_request_int/1 (src/chttpd.erl, line 276) in call from mochiweb_http:headers/6 (src/mochiweb_http.erl, line 122) ``` Project: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/commit/a57e8699 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/tree/a57e8699 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/diff/a57e8699 Branch: refs/heads/master Commit: a57e86994f6f5610edc3dca31ca373db92306d8b Parents: e5b1aee Author: Klaus Trainer Authored: Mon Nov 2 23:12:04 2015 +0100 Committer: Klaus Trainer Committed: Mon Nov 2 23:23:31 2015 +0100 ---------------------------------------------------------------------- src/chttpd_db.erl | 3 ++- src/chttpd_view.erl | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/a57e8699/src/chttpd_db.erl ---------------------------------------------------------------------- diff --git a/src/chttpd_db.erl b/src/chttpd_db.erl index 842593e..d4e29cb 100644 --- a/src/chttpd_db.erl +++ b/src/chttpd_db.erl @@ -618,7 +618,8 @@ all_docs_view(Req, Db, Keys, OP) -> Options = [{user_ctx, Req#httpd.user_ctx}], Max = chttpd:chunked_response_buffer_size(), VAcc = #vacc{db=Db, req=Req, threshold=Max}, - fabric:all_docs(Db, Options, fun couch_mrview_http:view_cb/2, VAcc, Args3). + {ok, Resp} = fabric:all_docs(Db, Options, fun couch_mrview_http:view_cb/2, VAcc, Args3), + {ok, Resp#vacc.resp}. db_doc_req(#httpd{method='DELETE'}=Req, Db, DocId) -> % check for the existence of the doc to handle the 404 case. http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/a57e8699/src/chttpd_view.erl ---------------------------------------------------------------------- diff --git a/src/chttpd_view.erl b/src/chttpd_view.erl index ea86095..eccf290 100644 --- a/src/chttpd_view.erl +++ b/src/chttpd_view.erl @@ -33,14 +33,16 @@ multi_query_view(Req, Db, DDoc, ViewName, Queries) -> Acc1 end, VAcc1, ArgQueries), {ok, Resp1} = chttpd:send_delayed_chunk(VAcc2#vacc.resp, "\r\n]}"), - chttpd:end_delayed_json_response(Resp1). + {ok, Resp2} = chttpd:end_delayed_json_response(Resp1), + {ok, Resp2#vacc.resp}. design_doc_view(Req, Db, DDoc, ViewName, Keys) -> Args = couch_mrview_http:parse_params(Req, Keys), Max = chttpd:chunked_response_buffer_size(), VAcc = #vacc{db=Db, req=Req, threshold=Max}, - fabric:query_view(Db, DDoc, ViewName, fun couch_mrview_http:view_cb/2, VAcc, Args). + {ok, Resp} = fabric:query_view(Db, DDoc, ViewName, fun couch_mrview_http:view_cb/2, VAcc, Args), + {ok, Resp#vacc.resp}. handle_view_req(#httpd{method='GET', path_parts=[_, _, _, _, ViewName]}=Req, Db, DDoc) ->