couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r1035582 - /couchdb/branches/1.0.x/src/couchdb/couch_httpd.erl
Date Tue, 16 Nov 2010 10:56:11 GMT
Author: jan
Date: Tue Nov 16 10:56:11 2010
New Revision: 1035582

URL: http://svn.apache.org/viewvc?rev=1035582&view=rev
Log:
After authentication, redirect to the path the user requested, not
the one that is used internally.

Modified:
    couchdb/branches/1.0.x/src/couchdb/couch_httpd.erl

Modified: couchdb/branches/1.0.x/src/couchdb/couch_httpd.erl
URL: http://svn.apache.org/viewvc/couchdb/branches/1.0.x/src/couchdb/couch_httpd.erl?rev=1035582&r1=1035581&r2=1035582&view=diff
==============================================================================
--- couchdb/branches/1.0.x/src/couchdb/couch_httpd.erl (original)
+++ couchdb/branches/1.0.x/src/couchdb/couch_httpd.erl Tue Nov 16 10:56:11 2010
@@ -769,7 +769,13 @@ error_headers(#httpd{mochi_req=MochiReq}
                                 {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



Mime
View raw message