couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randall Leeds <randall.le...@gmail.com>
Subject [PATCH] fix show/list/external requested_path for rewrites
Date Sun, 22 Jan 2012 03:17:14 GMT
From: Randall Leeds <randall@apache.org>

Since we're using this header to track the requested path we should
expose it in the request object we pass to the view server. Currently
this object has the pre-vhost path but the post-rewrite path when there
is no virtual host. With this change it always presents the path
requested by the client, with or without virtual hosts.

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.

I send this to dev@ rather than JIRA because it's trivial and I'd like
to merge this for 1.2 if there are no objections.
---
 src/couchdb/couch_httpd.erl |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

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,
 
-- 
1.7.5.4


Mime
View raw message