http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.15
B. On 27 May 2011 04:52, Benoit Chesneau <[email protected]> wrote: > On Fri, May 27, 2011 at 5:30 AM, Benoit Chesneau <[email protected]> wrote: >> On Thu, May 26, 2011 at 9:00 PM, <[email protected]> wrote: >>> 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 >>> >>> >>> >> Why do we base64 encode a md5 ? There is no risk we can find bad chars >> in ... Also wi win some ms to not do it. >> >> - benoît >> > s/wi/we . early morning >
