]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
backport this from 2.1-dev:
authorJeff Trawick <trawick@apache.org>
Sat, 3 Jul 2004 12:48:01 +0000 (12:48 +0000)
committerJeff Trawick <trawick@apache.org>
Sat, 3 Jul 2004 12:48:01 +0000 (12:48 +0000)
  Small fix to allow reverse proxying to an ftp server. Previously
  an attempt to do this would try and connect to 0.0.0.0, regardless
  of the server specified.

PR:            24922
Submitted by:  Pascal Terjan <pterjan@linuxfr.org>
Reviewed by:   minfrin, nd, jim, trawick

(note: this commit includes minor style-only repairs to the
original patch; see r1.144 of proxy_ftp.c)

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/APACHE_2_0_BRANCH@104149 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
STATUS
modules/proxy/proxy_ftp.c

diff --git a/CHANGES b/CHANGES
index cd5cf13168a09dd84b2f1d6d9995f4146da5cfc7..d172dc12031d582c523ea3c90f4ed7461a0bcde2 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,10 @@
 Changes with Apache 2.0.51
 
+  *) Small fix to allow reverse proxying to an ftp server. Previously
+     an attempt to do this would try and connect to 0.0.0.0, regardless
+     of the server specified. PR 24922
+     [Pascal Terjan <pterjan@linuxfr.org>]
+
   *) Add the NOTICE file to the rpm spec file in compliance with the
      Apache v2.0 license. [Graham Leggett]
  
diff --git a/STATUS b/STATUS
index 26894964afb4fe6f7fd81908fdd7080320b61ae2..9e6354f0873b83b19d4377cf0f7fa616a2dcc72e 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -1,5 +1,5 @@
 APACHE 2.0 STATUS:                                              -*-text-*-
-Last modified at [$Date: 2004/07/02 17:42:54 $]
+Last modified at [$Date: 2004/07/03 12:48:00 $]
 
 Release:
 
@@ -128,13 +128,6 @@ PATCHES TO BACKPORT FROM 2.1
        docs/manual/mod/mod_ldap.xml r1.12
        +1 minfrin, bnicholes, trawick
 
-    *) Small fix to allow reverse proxying to an ftp server. Previously
-       an attempt to do this would try and connect to 0.0.0.0, regardless
-       of the server specified.
-         modules/proxy/proxy_ftp.c r1.143
-       PR 24922 [Pascal Terjan <pterjan@linuxfr.org>]
-       +1: minfrin, nd, jim
-
     *) Prevent Win32 pool corruption at startup
          server/mpm/winnt/child.c: r1.36 
        +1: ake, trawick, nd, stoddard
index fdd9172566f613b92d1cf403f36ac2edc377ce6a..d4deb580dae19fec19eab84cb9ed3630c9e2f161 100644 (file)
@@ -754,6 +754,7 @@ int ap_proxy_ftp_handler(request_rec *r, proxy_server_conf *conf,
     char buffer[MAX_STRING_LEN];
     char *ftpmessage = NULL;
     char *path, *strp, *type_suffix, *cwd = NULL;
+    apr_uri_t uri; 
     char *user = NULL;
 /*    char *account = NULL; how to supply an account in a URL? */
     const char *password = NULL;
@@ -808,13 +809,24 @@ int ap_proxy_ftp_handler(request_rec *r, proxy_server_conf *conf,
     if (r->method_number != M_GET)
         return HTTP_NOT_IMPLEMENTED;
 
-
     /* We break the URL into host, port, path-search */
-    connectname = r->parsed_uri.hostname;
-    connectport = (r->parsed_uri.port != 0)
-        ? r->parsed_uri.port
-        : apr_uri_port_of_scheme("ftp");
-    path = apr_pstrdup(p, r->parsed_uri.path);
+    if (r->parsed_uri.hostname == NULL) {
+        if (APR_SUCCESS != apr_uri_parse(p, url, &uri)) {
+            return ap_proxyerror(r, HTTP_BAD_REQUEST,
+                apr_psprintf(p, "URI cannot be parsed: %s", url));
+        }
+        connectname = uri.hostname;
+        connectport = uri.port;
+        path = apr_pstrdup(p, uri.path);
+    }
+    else {
+        connectname = r->parsed_uri.hostname;
+        connectport = r->parsed_uri.port;
+        path = apr_pstrdup(p, r->parsed_uri.path);
+    }
+    if (connectport == 0) {
+        connectport = apr_uri_port_of_scheme("ftp");
+    }
     path = (path != NULL && path[0] != '\0') ? &path[1] : "";
 
     type_suffix = strchr(path, ';');