You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Joe Orton <jo...@redhat.com> on 2000/12/22 17:17:24 UTC

[PATCH] 1.3: fix ProxyPass to FTP segfault

At the moment, if you use an FTP URL with ProxyPass, the server will
segfault when a request is made. There's a PR on this:

http://bugs.apache.org/index.cgi/full/4774

The segfault happens because r->parsed_uri doesn't get filled in
completely, and ap_proxy_ftp_handler expects it to be.

Fix that, and the server just hangs because of the other FTP data
connection problem.

Fix that, and the ProxyPass is pretty useless because the HTML comes with
<BASE HREF=ftp://blah/> which means you get sent to the FTP server if you
follow any links, rather than using HTTP to the proxy.

I think there is some clever trick which the BASE HREF= is solving though,
which I don't understand - it looks like Martin added this, maybe he can
help me?

If these fixes are not acceptable, I can submit a patch which makes ftp://
URLs in ProxyPass a configuration error so this at least doesn't cause
users any surprises.

Regards,

joe

--- proxy_ftp.c.1	Fri Dec 22 15:55:24 2000
+++ proxy_ftp.c	Fri Dec 22 16:00:07 2000
@@ -290,10 +290,9 @@
     /* print "ftp://host/" */
     n = ap_snprintf(buf, sizeof(buf), DOCTYPE_HTML_3_2
 		"<HTML><HEAD><TITLE>%s%s</TITLE>\n"
-		"<BASE HREF=\"%s%s\"></HEAD>\n"
 		"<BODY><H2>Directory of "
 		"<A HREF=\"/\">%s</A>/",
-		site, path, site, path, site);
+		site, path, site);
     total_bytes_sent += ap_proxy_bputs2(buf, con->client, c);
 
     while ((dir = strchr(dir+1, '/')) != NULL)
@@ -489,6 +488,11 @@
 	return HTTP_NOT_IMPLEMENTED;
 
 /* We break the URL into host, port, path-search */
+
+    if (r->parsed_uri.hostname == NULL) {
+	/* This is a ProxyPass */
+	ap_parse_uri(r, url);
+    }
 
     host = r->parsed_uri.hostname;
     port = (r->parsed_uri.port != 0)