couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kxe...@apache.org
Subject chttpd commit: updated refs/heads/master to 19f9260
Date Tue, 24 Nov 2015 20:29:00 GMT
Repository: couchdb-chttpd
Updated Branches:
  refs/heads/master 7dcf1279b -> 19f92604a


Provide information about actual request path when vhost is used


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

Branch: refs/heads/master
Commit: 19f92604a31f61235d5d3c9f3383680a75fb7305
Parents: 7dcf127
Author: Alexander Shorin <kxepal@apache.org>
Authored: Sat Aug 8 19:20:56 2015 +0300
Committer: Alexander Shorin <kxepal@apache.org>
Committed: Tue Nov 24 23:25:44 2015 +0300

----------------------------------------------------------------------
 src/chttpd.erl | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/19f92604/src/chttpd.erl
----------------------------------------------------------------------
diff --git a/src/chttpd.erl b/src/chttpd.erl
index 7e214a9..2988012 100644
--- a/src/chttpd.erl
+++ b/src/chttpd.erl
@@ -156,6 +156,16 @@ handle_request_int(MochiReq) ->
     RawUri = MochiReq:get(raw_path),
     {"/" ++ Path, _, _} = mochiweb_util:urlsplit_path(RawUri),
 
+    % get requested path
+    RequestedPath = case MochiReq:get_header_value("x-couchdb-vhost-path") of
+        undefined ->
+            case MochiReq:get_header_value("x-couchdb-requested-path") of
+                undefined -> RawUri;
+                R -> R
+            end;
+        P -> P
+    end,
+
     Peer = MochiReq:get(peer),
 
     Method1 =
@@ -201,7 +211,9 @@ handle_request_int(MochiReq) ->
         nonce = Nonce,
         method = Method,
         path_parts = [list_to_binary(chttpd:unquote(Part))
-                || Part <- string:tokens(Path, "/")]
+                || Part <- string:tokens(Path, "/")],
+        requested_path_parts = [?l2b(unquote(Part))
+                || Part <- string:tokens(RequestedPath, "/")]
     },
 
     % put small token on heap to keep requests synced to backend calls


Mime
View raw message