couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From iil...@apache.org
Subject [15/50] couch-httpd commit: updated refs/heads/split_out_httpd_stack to e44a372
Date Tue, 01 Mar 2016 20:00:48 GMT
Bring etag_maybe/2 from original


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-httpd/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-httpd/commit/cf6dead8
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-httpd/tree/cf6dead8
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-httpd/diff/cf6dead8

Branch: refs/heads/split_out_httpd_stack
Commit: cf6dead83181f6b28c04df3e1f35ba44ac4dc2e7
Parents: 7c335ff
Author: ILYA Khlopotov <iilyak@ca.ibm.com>
Authored: Thu Feb 25 11:42:46 2016 -0800
Committer: ILYA Khlopotov <iilyak@ca.ibm.com>
Committed: Tue Mar 1 08:35:07 2016 -0800

----------------------------------------------------------------------
 src/couch_httpd.erl          |  9 +++++++++
 src/couch_httpd_original.erl | 12 ++----------
 2 files changed, 11 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-httpd/blob/cf6dead8/src/couch_httpd.erl
----------------------------------------------------------------------
diff --git a/src/couch_httpd.erl b/src/couch_httpd.erl
index 3c470e2..90016f0 100644
--- a/src/couch_httpd.erl
+++ b/src/couch_httpd.erl
@@ -93,6 +93,7 @@
     doc_etag/1,
     make_etag/1,
     etag_match/2,
+    etag_maybe/2,
     etag_respond/3
 ]).
 
@@ -460,6 +461,14 @@ etag_match(Req, CurrentEtag) ->
         header_value(Req, "If-None-Match", ""), ", "),
     lists:member(CurrentEtag, EtagsToMatch).
 
+etag_maybe(Req, RespFun) ->
+    try
+        RespFun()
+    catch
+        throw:{etag_match, ETag} ->
+            send_response(Req, 304, [{"ETag", ETag}], <<>>)
+    end.
+
 etag_respond(Req, CurrentEtag, RespFun) ->
     case etag_match(Req, CurrentEtag) of
     true ->

http://git-wip-us.apache.org/repos/asf/couchdb-couch-httpd/blob/cf6dead8/src/couch_httpd_original.erl
----------------------------------------------------------------------
diff --git a/src/couch_httpd_original.erl b/src/couch_httpd_original.erl
index e8e6ffe..8195e46 100644
--- a/src/couch_httpd_original.erl
+++ b/src/couch_httpd_original.erl
@@ -19,7 +19,6 @@
 -export([verify_is_server_admin/1,error_info/1]).
 -export([make_fun_spec_strs/1]).
 
--export([etag_maybe/2]).
 
 -export([start_chunked_response/3]).
 -export([send_response/4,send_error/2,send_error/4, send_chunked_error/2]).
@@ -69,7 +68,8 @@
     etag_match/2,
     start_reponse/3,
     start_response_length/4,
-    send_chunk/2
+    send_chunk/2,
+    etag_maybe/2
 ]).
 
 -define(HANDLER_NAME_IN_MODULE_POS, 6).
@@ -479,14 +479,6 @@ host_for_request(#httpd{mochi_req=MochiReq}) ->
     end.
 
 
-etag_maybe(Req, RespFun) ->
-    try
-        RespFun()
-    catch
-        throw:{etag_match, ETag} ->
-            send_response(Req, 304, [{"ETag", ETag}], <<>>)
-    end.
-
 verify_is_server_admin(#httpd{user_ctx=UserCtx}) ->
     verify_is_server_admin(UserCtx);
 verify_is_server_admin(#user_ctx{roles=Roles}) ->


Mime
View raw message