couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject svn commit: r1164290 - in /couchdb/trunk/src/couchdb: couch_httpd.erl couch_httpd_db.erl couch_httpd_show.erl couch_httpd_view.erl
Date Thu, 01 Sep 2011 22:15:13 GMT
Author: rnewson
Date: Thu Sep  1 22:15:13 2011
New Revision: 1164290

URL: http://svn.apache.org/viewvc?rev=1164290&view=rev
Log:
COUCHDB-1269 - use canonical spelling for ETag header.

Modified:
    couchdb/trunk/src/couchdb/couch_httpd.erl
    couchdb/trunk/src/couchdb/couch_httpd_db.erl
    couchdb/trunk/src/couchdb/couch_httpd_show.erl
    couchdb/trunk/src/couchdb/couch_httpd_view.erl

Modified: couchdb/trunk/src/couchdb/couch_httpd.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd.erl?rev=1164290&r1=1164289&r2=1164290&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_httpd.erl (original)
+++ couchdb/trunk/src/couchdb/couch_httpd.erl Thu Sep  1 22:15:13 2011
@@ -572,7 +572,7 @@ etag_respond(Req, CurrentEtag, RespFun) 
     case etag_match(Req, CurrentEtag) of
     true ->
         % the client has this in their cache.
-        send_response(Req, 304, [{"Etag", CurrentEtag}], <<>>);
+        send_response(Req, 304, [{"ETag", CurrentEtag}], <<>>);
     false ->
         % Run the function.
         RespFun()

Modified: couchdb/trunk/src/couchdb/couch_httpd_db.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd_db.erl?rev=1164290&r1=1164289&r2=1164290&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_httpd_db.erl (original)
+++ couchdb/trunk/src/couchdb/couch_httpd_db.erl Thu Sep  1 22:15:13 2011
@@ -101,7 +101,7 @@ handle_changes_req1(Req, Db) ->
                 CurrentEtag,
                 fun() ->
                     {ok, Resp} = couch_httpd:start_json_response(
-                         Req, 200, [{"Etag", CurrentEtag}]
+                         Req, 200, [{"ETag", CurrentEtag}]
                     ),
                     FeedChangesFun(MakeCallback(Resp))
                 end
@@ -682,7 +682,7 @@ db_doc_req(#httpd{method='POST'}=Req, Db
     },
     {ok, NewRev} = couch_db:update_doc(Db, NewDoc, []),
 
-    send_json(Req, 201, [{"Etag", "\"" ++ ?b2l(couch_doc:rev_to_str(NewRev)) ++ "\""}], {[
+    send_json(Req, 201, [{"ETag", "\"" ++ ?b2l(couch_doc:rev_to_str(NewRev)) ++ "\""}], {[
         {ok, true},
         {id, DocId},
         {rev, couch_doc:rev_to_str(NewRev)}
@@ -749,7 +749,7 @@ db_doc_req(#httpd{method='COPY'}=Req, Db
         Doc#doc{id=TargetDocId, revs=TargetRevs}, []),
     % respond
     send_json(Req, 201,
-        [{"Etag", "\"" ++ ?b2l(couch_doc:rev_to_str(NewTargetRev)) ++ "\""}],
+        [{"ETag", "\"" ++ ?b2l(couch_doc:rev_to_str(NewTargetRev)) ++ "\""}],
         update_doc_result_to_json(TargetDocId, {ok, NewTargetRev}));
 
 db_doc_req(Req, _Db, _DocId) ->
@@ -762,7 +762,7 @@ send_doc(Req, Doc, Options) ->
         DiskEtag = couch_httpd:doc_etag(Doc),
         % output etag only when we have no meta
         couch_httpd:etag_respond(Req, DiskEtag, fun() ->
-            send_doc_efficiently(Req, Doc, [{"Etag", DiskEtag}], Options)
+            send_doc_efficiently(Req, Doc, [{"ETag", DiskEtag}], Options)
         end);
     _ ->
         send_doc_efficiently(Req, Doc, [], Options)
@@ -887,7 +887,7 @@ update_doc(Req, Db, DocId, #doc{deleted=
     end,
     {ok, NewRev} = couch_db:update_doc(Db, Doc, Options, UpdateType),
     NewRevStr = couch_doc:rev_to_str(NewRev),
-    ResponseHeaders = [{"Etag", <<"\"", NewRevStr/binary, "\"">>}] ++ Headers,
+    ResponseHeaders = [{"ETag", <<"\"", NewRevStr/binary, "\"">>}] ++ Headers,
     send_json(Req, if Deleted -> 200; true -> 201 end,
         ResponseHeaders, {[
             {ok, true},
@@ -1132,7 +1132,7 @@ db_attachment_req(#httpd{method=Method,m
         'DELETE' ->
             {200, []};
         _ ->
-            {201, [{"Etag", "\"" ++ ?b2l(couch_doc:rev_to_str(UpdatedRev)) ++ "\""},
+            {201, [{"ETag", "\"" ++ ?b2l(couch_doc:rev_to_str(UpdatedRev)) ++ "\""},
                {"Location", absolute_uri(Req, "/" ++
                 binary_to_list(DbName) ++ "/" ++
                 binary_to_list(DocId) ++ "/" ++

Modified: couchdb/trunk/src/couchdb/couch_httpd_show.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd_show.erl?rev=1164290&r1=1164289&r2=1164290&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_httpd_show.erl (original)
+++ couchdb/trunk/src/couchdb/couch_httpd_show.erl Thu Sep  1 22:15:13 2011
@@ -390,11 +390,11 @@ apply_etag({ExternalResponse}, CurrentEt
     nil ->
         % no JSON headers
         % add our Etag and Vary headers to the response
-        {[{<<"headers">>, {[{<<"Etag">>, CurrentEtag}, {<<"Vary">>,
<<"Accept">>}]}} | ExternalResponse]};
+        {[{<<"headers">>, {[{<<"ETag">>, CurrentEtag}, {<<"Vary">>,
<<"Accept">>}]}} | ExternalResponse]};
     JsonHeaders ->
         {[case Field of
         {<<"headers">>, JsonHeaders} -> % add our headers
-            JsonHeadersEtagged = couch_util:json_apply_field({<<"Etag">>, CurrentEtag},
JsonHeaders),
+            JsonHeadersEtagged = couch_util:json_apply_field({<<"ETag">>, CurrentEtag},
JsonHeaders),
             JsonHeadersVaried = couch_util:json_apply_field({<<"Vary">>, <<"Accept">>},
JsonHeadersEtagged),
             {<<"headers">>, JsonHeadersVaried};
         _ -> % skip non-header fields

Modified: couchdb/trunk/src/couchdb/couch_httpd_view.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd_view.erl?rev=1164290&r1=1164289&r2=1164290&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_httpd_view.erl (original)
+++ couchdb/trunk/src/couchdb/couch_httpd_view.erl Thu Sep  1 22:15:13 2011
@@ -628,7 +628,7 @@ make_end_key_option(
     [{end_key_gt, {EndKey,reverse_key_default(EndDocId)}}].
 
 json_view_start_resp(Req, Etag, TotalViewCount, Offset, _Acc, UpdateSeq) ->
-    {ok, Resp} = start_json_response(Req, 200, [{"Etag", Etag}]),
+    {ok, Resp} = start_json_response(Req, 200, [{"ETag", Etag}]),
     BeginBody = case couch_httpd:qs_value(Req, "update_seq") of
     "true" ->
         io_lib:format(
@@ -648,7 +648,7 @@ send_json_view_row(Resp, Db, Kv, Include
     {ok, ",\r\n"}.
 
 json_reduce_start_resp(Req, Etag, _Acc0, UpdateSeq) ->
-    {ok, Resp} = start_json_response(Req, 200, [{"Etag", Etag}]),
+    {ok, Resp} = start_json_response(Req, 200, [{"ETag", Etag}]),
     case couch_httpd:qs_value(Req, "update_seq") of
     "true" ->
         {ok, Resp, io_lib:format("{\"update_seq\":~w,\"rows\":[\r\n",[UpdateSeq])};



Mime
View raw message