FAQ
wrap the chunk fun so rcouch-couch doesn't depends on mochiweb


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-httpd/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-httpd/commit/b897545a
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-httpd/tree/b897545a
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-httpd/diff/b897545a

Branch: refs/heads/1994-merge-rcouch
Commit: b897545ac25bd314056a1accee8283bb8c6fc475
Parents: ffd029b
Author: benoitc <bchesneau@gmail.com>
Authored: Tue Jul 8 11:10:59 2014 +0200
Committer: benoitc <bchesneau@gmail.com>
Committed: Sun Jul 13 14:33:20 2014 +0200

----------------------------------------------------------------------
  src/couch_httpd_changes.erl | 2 +-
  src/couch_httpd_db.erl | 12 +++++++++++-
  2 files changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-httpd/blob/b897545a/src/couch_httpd_changes.erl
----------------------------------------------------------------------
diff --git a/src/couch_httpd_changes.erl b/src/couch_httpd_changes.erl
index ad99ae7..28f9523 100644
--- a/src/couch_httpd_changes.erl
+++ b/src/couch_httpd_changes.erl
@@ -145,7 +145,7 @@ handle_view_changes(ChangesArgs, #httpd{method=Method}=Req, Db) ->
              NoIndex1 = (couch_util:get_value(<<"use_index">>, Q,
                                              <<"yes">>) =:= <<"no">>),
              {Q, Queries1, NoIndex1, true};
- _ ->
+ #httpd{}=Req ->
              Q = couch_httpd:qs(Req),
              Queries1 = case Method of
                  'POST' ->

http://git-wip-us.apache.org/repos/asf/couchdb-couch-httpd/blob/b897545a/src/couch_httpd_db.erl
----------------------------------------------------------------------
diff --git a/src/couch_httpd_db.erl b/src/couch_httpd_db.erl
index 0d1e0f8..c63e74d 100644
--- a/src/couch_httpd_db.erl
+++ b/src/couch_httpd_db.erl
@@ -945,8 +945,18 @@ db_attachment_req(#httpd{method=Method,mochi_req=MochiReq}=Req, Db, DocId, FileN
                          exit({unknown_transfer_encoding, Unknown});
                      chunked ->
                          fun(MaxChunkSize, ChunkFun, InitState) ->
+ ChunkFunWrapper = fun
+ ({0, Footers}, Acc) ->
+ F = mochiweb_headers:from_binary(Footers),
+ Md5 = mochiweb_headers:get_value(
+ "Content-MD5", F),
+ ChunkFun(Md5, Acc);
+ (Else, Acc) ->
+ ChunkFun(Else, Acc)
+ end,
+
                              couch_httpd:recv_chunked(Req, MaxChunkSize,
- ChunkFun, InitState)
+ ChunkFunWrapper, InitState)
                          end;
                      0 ->
                          <<"">>;

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 10 | next ›
Discussion Overview
groupcommits @
categoriescouchdb
postedJul 13, '14 at 12:34p
activeJul 13, '14 at 12:34p
posts10
users1
websitecouchdb.apache.org
irc#couchdb

1 user in discussion

Benoitc: 10 posts

People

Translate

site design / logo © 2021 Grokbase