]> granicus.if.org Git - apache/commitdiff
* Correctly construct base href url in the reverse proxy case.
authorRuediger Pluem <rpluem@apache.org>
Tue, 27 Jan 2009 22:08:23 +0000 (22:08 +0000)
committerRuediger Pluem <rpluem@apache.org>
Tue, 27 Jan 2009 22:08:23 +0000 (22:08 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@738268 13f79535-47bb-0310-9956-ffa450edef68

modules/proxy/mod_proxy_ftp.c

index d92b0ca7a201a3a17026899a15fb802d58ccf697..1058bfe25caba14a1723c77d1c9b6fcbb4aeb095 100644 (file)
@@ -316,15 +316,24 @@ static apr_status_t proxy_send_dir_filter(ap_filter_t *f,
         char *wildcard = NULL;
         const char *escpath;
 
-        /* Save "scheme://site" prefix without password */
-        site = apr_uri_unparse(p, &f->r->parsed_uri, APR_URI_UNP_OMITPASSWORD | APR_URI_UNP_OMITPATHINFO);
         /*
-         * In the reverse proxy case we usually have no site. So contruct
-         * one.
+         * In the reverse proxy case we need to construct our site string
+         * via ap_construct_url. For non anonymous sites apr_uri_unparse would
+         * only supply us with 'username@' which leads to the construction of
+         * an invalid base href later on. Losing the username part of the URL
+         * is no problem in the reverse proxy case as the browser sents the
+         * credentials anyway once entered.
          */
-        if ((*site == '\0') && (r->proxyreq == PROXYREQ_REVERSE)) {
+        if (r->proxyreq == PROXYREQ_REVERSE) {
             site = ap_construct_url(p, "", r);
         }
+        else {
+            /* Save "scheme://site" prefix without password */
+            site = apr_uri_unparse(p, &f->r->parsed_uri,
+                                   APR_URI_UNP_OMITPASSWORD |
+                                   APR_URI_UNP_OMITPATHINFO);
+        }
+
         /* ... and path without query args */
         path = apr_uri_unparse(p, &f->r->parsed_uri, APR_URI_UNP_OMITSITEPART | APR_URI_UNP_OMITQUERY);