couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randall Leeds <rand...@apache.org>
Subject Re: [PATCH] fix show/list/external requested_path for rewrites
Date Sun, 22 Jan 2012 03:20:06 GMT
Sorry... if this was unclear, this will change the string stored in
the `requested_path` property of the request object.

Example:

function (doc, req) {
  //req has `path` and `requested_path` but currently the latter is
broken when there is no vhost and a rewrite
}

On Sat, Jan 21, 2012 at 19:17, Randall Leeds <randall.leeds@gmail.com> wrote:
> 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