On Thu, May 26, 2011 at 9:00 PM, <rnewson@apache.org> 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
- benoîr
|