Return-Path: X-Original-To: apmail-couchdb-commits-archive@www.apache.org Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D70B3B33B for ; Mon, 23 Jan 2012 01:49:54 +0000 (UTC) Received: (qmail 6898 invoked by uid 500); 23 Jan 2012 01:49:54 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 6802 invoked by uid 500); 23 Jan 2012 01:49:54 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 6789 invoked by uid 99); 23 Jan 2012 01:49:53 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 23 Jan 2012 01:49:53 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.114] (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 23 Jan 2012 01:49:52 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id CCF2331919C; Mon, 23 Jan 2012 01:49:32 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: randall@apache.org To: commits@couchdb.apache.org X-Mailer: ASF-Git Admin Mailer Subject: [2/2] git commit: fix show/list/external requested_path for rewrites Message-Id: <20120123014932.CCF2331919C@tyr.zones.apache.org> Date: Mon, 23 Jan 2012 01:49:32 +0000 (UTC) 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 Authored: Sat Jan 21 19:05:48 2012 -0800 Committer: Randall Leeds 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,