summaryrefslogtreecommitdiff
path: root/src/couchdb/couch_db.erl
diff options
context:
space:
mode:
authorAdam Kocoloski <kocolosk@apache.org>2010-04-15 16:40:36 +0000
committerAdam Kocoloski <kocolosk@apache.org>2010-04-15 16:40:36 +0000
commit9bb6096e300765a88fc4ab48a6038e8b6d78db94 (patch)
tree68fca5eb638cd64766a7cf39c2d2e4809f17a42c /src/couchdb/couch_db.erl
parentf3e688373082574d6f469acc282b873658a2321a (diff)
accept gzipped attachments w/ standalone api. thx fdmanana. COUCHDB-712
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@934481 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb/couch_db.erl')
-rw-r--r--src/couchdb/couch_db.erl11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/couchdb/couch_db.erl b/src/couchdb/couch_db.erl
index f4a9e352..85a83c08 100644
--- a/src/couchdb/couch_db.erl
+++ b/src/couchdb/couch_db.erl
@@ -850,7 +850,16 @@ with_stream(Fd, #att{md5=InMd5,type=Type,encoding=Enc}=Att, Fun) ->
{Len, IdentityLen, gzip}
end;
gzip ->
- {Att#att.att_len, Att#att.disk_len, Enc}
+ case {Att#att.att_len, Att#att.disk_len} of
+ {AL, DL} when AL =:= undefined orelse DL =:= undefined ->
+ % Compressed attachment uploaded through the standalone API.
+ {Len, Len, gzip};
+ {AL, DL} ->
+ % This case is used for efficient push-replication, where a
+ % compressed attachment is located in the body of multipart
+ % content-type request.
+ {AL, DL, gzip}
+ end
end,
Att#att{
data={Fd,StreamInfo},