You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ra...@apache.org on 2012/01/23 02:49:32 UTC

[2/2] git commit: fix show/list/external requested_path for rewrites

fix show/list/external requested_path for rewrites

Since we're using the x-couchdb-requested-path header to track the
requested path we should expose it in the request object we pass to
the view server. Currently this object has a `requested_path` key which
has the pre-vhost path. However, when there is no virtual host it will
have the post-rewrite path. With this change it always presents the path
which was requested by the client, whether or not virtual hosts were
matched.

This should make the lives of app authors easier by giving them a
reliable source for constructing relative paths and redirects that
works with and without virtual hosts.


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

Branch: refs/heads/master
Commit: 879a1bc19b145e126b9386aed2023f9cd1df8b31
Parents: 572b561
Author: Randall Leeds <ra...@apache.org>
Authored: Sat Jan 21 19:05:48 2012 -0800
Committer: Randall Leeds <ra...@apache.org>
Committed: Sun Jan 22 17:45:46 2012 -0800

----------------------------------------------------------------------
 src/couchdb/couch_httpd.erl |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/879a1bc1/src/couchdb/couch_httpd.erl
----------------------------------------------------------------------
diff --git a/src/couchdb/couch_httpd.erl b/src/couchdb/couch_httpd.erl
index 9b59f71..11dc45a 100644
--- a/src/couchdb/couch_httpd.erl
+++ b/src/couchdb/couch_httpd.erl
@@ -237,7 +237,11 @@ handle_request_int(MochiReq, DefaultFun,
 
     % get requested path
     RequestedPath = case MochiReq:get_header_value("x-couchdb-vhost-path") of
-        undefined -> RawUri;
+        undefined ->
+            case MochiReq:get_header_value("x-couchdb-requested-path") of
+                undefined -> RawUri;
+                R -> R
+            end;
         P -> P
     end,