You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2011/05/26 21:00:07 UTC
svn commit: r1128038 - /couchdb/branches/1.1.x/src/couchdb/couch_httpd_db.erl
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
Re: svn commit: r1128038 - /couchdb/branches/1.1.x/src/couchdb/couch_httpd_db.erl
Posted by Benoit Chesneau <bc...@gmail.com>.
ok.
On Friday, May 27, 2011, Robert Newson <ro...@gmail.com> wrote:
> http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.15
>
> B.
>
> On 27 May 2011 04:52, Benoit Chesneau <bc...@gmail.com> wrote:
>> On Fri, May 27, 2011 at 5:30 AM, Benoit Chesneau <bc...@gmail.com> wrote:
>>> On Thu, May 26, 2011 at 9:00 PM, <rn...@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
>>>
>> s/wi/we . early morning
>>
>
Re: svn commit: r1128038 - /couchdb/branches/1.1.x/src/couchdb/couch_httpd_db.erl
Posted by Robert Newson <ro...@gmail.com>.
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.15
B.
On 27 May 2011 04:52, Benoit Chesneau <bc...@gmail.com> wrote:
> On Fri, May 27, 2011 at 5:30 AM, Benoit Chesneau <bc...@gmail.com> wrote:
>> On Thu, May 26, 2011 at 9:00 PM, <rn...@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
>>
> s/wi/we . early morning
>
Re: svn commit: r1128038 - /couchdb/branches/1.1.x/src/couchdb/couch_httpd_db.erl
Posted by Benoit Chesneau <bc...@gmail.com>.
On Fri, May 27, 2011 at 5:30 AM, Benoit Chesneau <bc...@gmail.com> wrote:
> On Thu, May 26, 2011 at 9:00 PM, <rn...@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
>
s/wi/we . early morning
Re: svn commit: r1128038 - /couchdb/branches/1.1.x/src/couchdb/couch_httpd_db.erl
Posted by Benoit Chesneau <bc...@gmail.com>.
On Thu, May 26, 2011 at 9:00 PM, <rn...@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