You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2012/03/14 23:28:02 UTC
[42/50] [abbrv] 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/384a75b6
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/384a75b6
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/384a75b6
Branch: refs/heads/COUCHDB-1426
Commit: 384a75b65fca44f6a491208c6fa40fbc25712199
Parents: 0fcb844
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:48:19 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/384a75b6/src/couchdb/couch_httpd.erl
----------------------------------------------------------------------
diff --git a/src/couchdb/couch_httpd.erl b/src/couchdb/couch_httpd.erl
index 192cb66..ea27bdf 100644
--- a/src/couchdb/couch_httpd.erl
+++ b/src/couchdb/couch_httpd.erl
@@ -236,7 +236,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,