couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From iil...@apache.org
Subject [2/6] couch commit: updated refs/heads/master to 171b751
Date Tue, 15 Mar 2016 17:34:35 GMT
Add chttpd_plugin:before_serve_file/5 EPI hook

COUCHDB-2966


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

Branch: refs/heads/master
Commit: 92283020d4fff94c82a077b4cb04d6b120f4cc2c
Parents: 44773a2
Author: ILYA Khlopotov <iilyak@ca.ibm.com>
Authored: Tue Mar 8 11:27:38 2016 -0800
Committer: ILYA Khlopotov <iilyak@ca.ibm.com>
Committed: Tue Mar 15 10:14:17 2016 -0700

----------------------------------------------------------------------
 src/couch_httpd.erl | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/92283020/src/couch_httpd.erl
----------------------------------------------------------------------
diff --git a/src/couch_httpd.erl b/src/couch_httpd.erl
index 6a1289e..ebfa5c3 100644
--- a/src/couch_httpd.erl
+++ b/src/couch_httpd.erl
@@ -476,11 +476,14 @@ accepted_encodings(#httpd{mochi_req=MochiReq}) ->
 serve_file(Req, RelativePath, DocumentRoot) ->
     serve_file(Req, RelativePath, DocumentRoot, []).
 
-serve_file(#httpd{mochi_req=MochiReq}=Req, RelativePath, DocumentRoot,
-           ExtraHeaders) ->
-    log_request(Req, 200),
-    Headers = basic_headers(Req, ExtraHeaders),
-    {ok, MochiReq:serve_file(RelativePath, DocumentRoot, Headers)}.
+serve_file(Req0, RelativePath0, DocumentRoot0, ExtraHeaders) ->
+    Headers0 = basic_headers(Req0, ExtraHeaders),
+    {ok, {Req1, Code1, Headers1, RelativePath1, DocumentRoot1}} =
+        chttpd_plugin:before_serve_file(
+            Req0, 200, Headers0, RelativePath0, DocumentRoot0),
+    log_request(Req1, Code1),
+    #httpd{mochi_req = MochiReq} = Req1,
+    {ok, MochiReq:serve_file(RelativePath1, DocumentRoot1, Headers1)}.
 
 qs_value(Req, Key) ->
     qs_value(Req, Key, undefined).


Mime
View raw message