couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject svn commit: r1128038 - /couchdb/branches/1.1.x/src/couchdb/couch_httpd_db.erl
Date Thu, 26 May 2011 19:00:07 GMT
Author: rnewson
Date: Thu May 26 19:00:07 2011
New Revision: 1128038

URL: http://svn.apache.org/viewvc?rev=1128038&view=rev
Log:
COUCHDB-1173 - return Content-MD5 when fetching attachments where possible.

Modified:
    couchdb/branches/1.1.x/src/couchdb/couch_httpd_db.erl

Modified: couchdb/branches/1.1.x/src/couchdb/couch_httpd_db.erl
URL: http://svn.apache.org/viewvc/couchdb/branches/1.1.x/src/couchdb/couch_httpd_db.erl?rev=1128038&r1=1128037&r2=1128038&view=diff
==============================================================================
--- couchdb/branches/1.1.x/src/couchdb/couch_httpd_db.erl (original)
+++ couchdb/branches/1.1.x/src/couchdb/couch_httpd_db.erl Thu May 26 19:00:07 2011
@@ -1004,7 +1004,13 @@ db_attachment_req(#httpd{method='GET',mo
                         {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



Mime
View raw message