summaryrefslogtreecommitdiff
path: root/src/couchdb
diff options
context:
space:
mode:
authorJan Lehnardt <jan@apache.org>2008-12-29 20:14:37 +0000
committerJan Lehnardt <jan@apache.org>2008-12-29 20:14:37 +0000
commit46874e0e90a46fefe0a6f7e1ef574bb6a2fcaf78 (patch)
treeed4692f9b8b3f31b1f35c4e01483b0fdf9ad14f3 /src/couchdb
parentcf018e7bf9b5673a1bd885e23dac7c92ee2fe968 (diff)
add etags to standalone attachment requests. Closes COUCHDB-184
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@729992 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb')
-rw-r--r--src/couchdb/couch_httpd_db.erl3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/couchdb/couch_httpd_db.erl b/src/couchdb/couch_httpd_db.erl
index 16956a86..eb41801f 100644
--- a/src/couchdb/couch_httpd_db.erl
+++ b/src/couchdb/couch_httpd_db.erl
@@ -513,12 +513,13 @@ couch_doc_open(Db, DocId, Rev, Options) ->
db_attachment_req(#httpd{method='GET'}=Req, Db, DocId, FileNameParts) ->
FileName = list_to_binary(mochiweb_util:join(lists:map(fun binary_to_list/1, FileNameParts),"/")),
case couch_db:open_doc(Db, DocId, []) of
- {ok, #doc{attachments=Attachments}} ->
+ {ok, #doc{attachments=Attachments, revs=[LastRev|_OldRevs]}} ->
case proplists:get_value(FileName, Attachments) of
undefined ->
throw({not_found, "Document is missing attachment"});
{Type, Bin} ->
{ok, Resp} = start_chunked_response(Req, 200, [
+ {"ETag", binary_to_list(LastRev)},
{"Cache-Control", "must-revalidate"},
{"Content-Type", binary_to_list(Type)}%,
% My understanding of http://www.faqs.org/rfcs/rfc2616.html