[once more for luck - thanks aggressive spam filter you are great i love you]

Content-MD5 is a standard HTTP header, there's no way to do what you
ask within RFC 2616.

On 26 May 2011 00:27, Robert Newson <robert.new...@gmail.com> wrote:
> Content-MD5 is a standard HTTP header, there's no way to do what you
> ask within RFC 2616.
>
> B.
>
> On 26 May 2011 00:10, Randall Leeds <randall.le...@gmail.com> wrote:
>> Should we break this into digest_type and digest so we can change it
>> in the future?
>>
>> On Wed, May 25, 2011 at 15:55,  <rnew...@apache.org> wrote:
>>> Author: rnewson
>>> Date: Wed May 25 22:55:09 2011
>>> New Revision: 1127713
>>>
>>> URL: http://svn.apache.org/viewvc?rev=1127713&view=rev
>>> Log:
>>> COUCHDB-1173 - return Content-MD5 when fetching attachments where possible.
>>>
>>> Modified:
>>>    couchdb/trunk/share/www/script/test/attachments.js
>>>    couchdb/trunk/src/couchdb/couch_httpd_db.erl
>>>
>>> Modified: couchdb/trunk/share/www/script/test/attachments.js
>>> URL: 
>>> http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/test/attachments.js?rev=1127713&r1=1127712&r2=1127713&view=diff
>>> ==============================================================================
>>> --- couchdb/trunk/share/www/script/test/attachments.js (original)
>>> +++ couchdb/trunk/share/www/script/test/attachments.js Wed May 25 22:55:09 
>>> 2011
>>> @@ -281,4 +281,17 @@ couchTests.attachments= function(debug)
>>>   } catch (e) {
>>>       T(e.error == "missing_stub");
>>>   }
>>> +
>>> +  // test MD5 header
>>> +  var bin_data = "foo bar"
>>> +  var xhr = CouchDB.request("PUT", 
>>> "/test_suite_db/bin_doc7/attachment.txt", {
>>> +    headers:{"Content-Type":"application/octet-stream",
>>> +             "Content-MD5":"MntvB0NYESObxH4VRDUycw=="},
>>> +    body:bin_data
>>> +  });
>>> +  TEquals(201, xhr.status);
>>> +
>>> +  var xhr = CouchDB.request("GET", 
>>> "/test_suite_db/bin_doc7/attachment.txt");
>>> +  TEquals('MntvB0NYESObxH4VRDUycw==', 
>>> xhr.getResponseHeader("Content-MD5"));
>>> +
>>>  };
>>>
>>> Modified: couchdb/trunk/src/couchdb/couch_httpd_db.erl
>>> URL: 
>>> http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd_db.erl?rev=1127713&r1=1127712&r2=1127713&view=diff
>>> ==============================================================================
>>> --- couchdb/trunk/src/couchdb/couch_httpd_db.erl (original)
>>> +++ couchdb/trunk/src/couchdb/couch_httpd_db.erl Wed May 25 22:55:09 2011
>>> @@ -1008,7 +1008,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
>>>
>>>
>>>
>>
>

Reply via email to