summaryrefslogtreecommitdiff
path: root/src/couchdb/couch_httpd.erl
diff options
context:
space:
mode:
authorJan Lehnardt <jan@apache.org>2010-11-16 10:56:11 +0000
committerJan Lehnardt <jan@apache.org>2010-11-16 10:56:11 +0000
commite55d96443d64f5cf8b654ca523b2476427273bd8 (patch)
treee69223bffc682be4d3d61e4b0e29c65499a108af /src/couchdb/couch_httpd.erl
parent10423ffe29a22f85df08b5391693d8dffff54945 (diff)
After authentication, redirect to the path the user requested, not
the one that is used internally. git-svn-id: https://svn.apache.org/repos/asf/couchdb/branches/1.0.x@1035582 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb/couch_httpd.erl')
-rw-r--r--src/couchdb/couch_httpd.erl8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/couchdb/couch_httpd.erl b/src/couchdb/couch_httpd.erl
index 8a5c699a..d24822aa 100644
--- a/src/couchdb/couch_httpd.erl
+++ b/src/couchdb/couch_httpd.erl
@@ -769,7 +769,13 @@ error_headers(#httpd{mochi_req=MochiReq}=Req, Code, ErrorStr, ReasonStr) ->
{Code, []};
match ->
AuthRedirectBin = ?l2b(AuthRedirect),
- UrlReturn = ?l2b(couch_util:url_encode(MochiReq:get(path))),
+ % Redirect to the path the user requested, not
+ % the one that is used internally.
+ UrlReturnRaw = case MochiReq:get_header_value("x-couchdb-vhost-path") of
+ undefined -> MochiReq:get(path);
+ VHostPath -> VHostPath
+ end,
+ UrlReturn = ?l2b(couch_util:url_encode(UrlReturnRaw)),
UrlReason = ?l2b(couch_util:url_encode(ReasonStr)),
{302, [{"Location", couch_httpd:absolute_uri(Req, <<AuthRedirectBin/binary,"?return=",UrlReturn/binary,"&reason=",UrlReason/binary>>)}]}
end