From 46874e0e90a46fefe0a6f7e1ef574bb6a2fcaf78 Mon Sep 17 00:00:00 2001 From: Jan Lehnardt Date: Mon, 29 Dec 2008 20:14:37 +0000 Subject: 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 --- src/couchdb/couch_httpd_db.erl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/couchdb') 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 -- cgit v1.2.3