diff options
Diffstat (limited to 'src/chttpd')
-rw-r--r-- | src/chttpd/src/chttpd_db.erl | 34 |
1 files changed, 1 insertions, 33 deletions
diff --git a/src/chttpd/src/chttpd_db.erl b/src/chttpd/src/chttpd_db.erl index f2bf447b7..e2de301b2 100644 --- a/src/chttpd/src/chttpd_db.erl +++ b/src/chttpd/src/chttpd_db.erl @@ -1728,18 +1728,7 @@ db_attachment_req(#httpd{method = 'GET', mochi_req = MochiReq} = Req, Db, DocId, {identity, Ranges} when is_list(Ranges) andalso length(Ranges) < 10 -> send_ranges_multipart(Req, Type, Len, Att, Ranges); _ -> - Headers1 = - Headers ++ - if - Enc =:= identity orelse ReqAcceptsAttEnc =:= true -> - [ - {"Content-MD5", - base64:encode(couch_att:fetch(md5, Att))} - ]; - true -> - [] - end, - {ok, Resp} = start_response_length(Req, 200, Headers1, Len), + {ok, Resp} = start_response_length(Req, 200, Headers, Len), AttFun(Att, fun(Seg, _) -> send(Resp, Seg) end, {ok, Resp}) end end @@ -1802,7 +1791,6 @@ db_attachment_req(#httpd{method = Method, user_ctx = Ctx} = Req, Db, DocId, File {type, MimeType}, {data, Data}, {att_len, ContentLen}, - {md5, get_md5_header(Req)}, {encoding, Encoding} ]) ] @@ -1944,26 +1932,6 @@ parse_ranges([{From, To} | Rest], Len, Acc) -> make_content_range(From, To, Len) -> ?l2b(io_lib:format("bytes ~B-~B/~B", [From, To, Len])). -get_md5_header(Req) -> - ContentMD5 = couch_httpd:header_value(Req, "Content-MD5"), - Length = couch_httpd:body_length(Req), - Trailer = couch_httpd:header_value(Req, "Trailer"), - case {ContentMD5, Length, Trailer} of - _ when is_list(ContentMD5) orelse is_binary(ContentMD5) -> - base64:decode(ContentMD5); - {_, chunked, undefined} -> - <<>>; - {_, chunked, _} -> - case re:run(Trailer, "\\bContent-MD5\\b", [caseless]) of - {match, _} -> - md5_in_footer; - _ -> - <<>> - end; - _ -> - <<>> - end. - parse_doc_query(Req) -> lists:foldl(fun parse_doc_query/2, #doc_query_args{}, chttpd:qs(Req)). |