couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject [7/9] git commit: Store the entire requested path in x-couchdb-vhost-fullpath
Date Wed, 29 Feb 2012 11:09:59 GMT
Store the entire requested path in x-couchdb-vhost-fullpath


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

Branch: refs/heads/COUCHDB-1416
Commit: 24a98d6c90d97274953d7419af6b9d9e5c479145
Parents: 2696850
Author: Jason Smith (air) <jhs@apache.org>
Authored: Wed Feb 29 03:41:38 2012 +0000
Committer: Jason Smith (air) <jhs@apache.org>
Committed: Wed Feb 29 03:41:38 2012 +0000

----------------------------------------------------------------------
 src/couchdb/couch_httpd_vhost.erl |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/24a98d6c/src/couchdb/couch_httpd_vhost.erl
----------------------------------------------------------------------
diff --git a/src/couchdb/couch_httpd_vhost.erl b/src/couchdb/couch_httpd_vhost.erl
index b63565b..411618c 100644
--- a/src/couchdb/couch_httpd_vhost.erl
+++ b/src/couchdb/couch_httpd_vhost.erl
@@ -123,7 +123,7 @@ dispatch_host(MochiReq) ->
                                       NewPath1,
                                       MochiReq:get(version),
                                       MochiReq:get(headers)),
-                    Fun(MochiReq1, VhostTarget)
+                    Fun(MochiReq1, {VPath, VhostTarget})
             end
     end,
     FinalMochiReq.
@@ -134,13 +134,18 @@ append_path(Target, Path) ->
     Target ++ Path.
 
 % default redirect vhost handler 
-redirect_to_vhost(MochiReq, VhostTarget) ->
+redirect_to_vhost(MochiReq, VhostTarget) when is_list(VhostTarget)->
+    redirect_to_vhost(MochiReq, {"", VhostTarget});
+
+redirect_to_vhost(MochiReq, {VPath, VhostTarget}) ->
     Path = MochiReq:get(raw_path),
     Target = append_path(VhostTarget, Path),
 
     ?LOG_DEBUG("Vhost Target: '~p'~n", [Target]),
 
-    Headers = mochiweb_headers:enter("x-couchdb-vhost-path", Path, 
+    Headers = mochiweb_headers:enter_from_list(
+        [{"x-couchdb-vhost-path", Path},
+         {"x-couchdb-vhost-fullpath", "/" ++ VPath}],
         MochiReq:get(headers)),
 
     % build a new mochiweb request


Mime
View raw message