diff options
author | Robert Newson <rnewson@apache.org> | 2011-05-26 19:00:07 +0000 |
---|---|---|
committer | Robert Newson <rnewson@apache.org> | 2011-05-26 19:00:07 +0000 |
commit | 052284d890277ebe27fc4dea06636669484f4586 (patch) | |
tree | fa4705a2358739e7723f3f58257f7d00bcd580ac | |
parent | 12e69371d6d708022c3f28548e6f5ca501328719 (diff) |
COUCHDB-1173 - return Content-MD5 when fetching attachments where possible.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/branches/1.1.x@1128038 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | src/couchdb/couch_httpd_db.erl | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/couchdb/couch_httpd_db.erl b/src/couchdb/couch_httpd_db.erl index 468ae3f0..2930462b 100644 --- a/src/couchdb/couch_httpd_db.erl +++ b/src/couchdb/couch_httpd_db.erl @@ -1004,7 +1004,13 @@ db_attachment_req(#httpd{method='GET',mochi_req=MochiReq}=Req, Db, DocId, FileNa {identity, Ranges} when is_list(Ranges) -> send_ranges_multipart(Req, Type, Len, Att, Ranges); _ -> - {ok, Resp} = start_response_length(Req, 200, Headers, Len), + Headers1 = Headers ++ + if Enc =:= identity orelse ReqAcceptsAttEnc =:= true -> + [{"Content-MD5", base64:encode(Att#att.md5)}]; + true -> + [] + end, + {ok, Resp} = start_response_length(Req, 200, Headers1, Len), AttFun(Att, fun(Seg, _) -> send(Resp, Seg) end, {ok, Resp}) end end |