You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Greg Stein <gs...@lyra.org> on 2001/12/06 01:01:13 UTC
server->port busted
The Port directive used to set the server->port variable. When Port was
tossed, we also lost the use of server->port. That affects the response of
ap_get_server_port() and ap_matches_request_vhost().
[ exercise for the reader to look into those ]
The basic problem is now that the server doesn't know its own port when it
needs to create a redirect or some kind of response. The ports are all in
the Listen records, which aren't readily available. And we don't get a full
mapping of the Listen stuff into the server_rec data.
The problems in ap_get_server_port() may be relaxed if we didn't enable
UseCanonicalName by default, but we do...
Example case: tell Apache that it is listening on port 8080. That port
number does not appear anywhere (not in a server_rec or a server_addr_rec).
When a client makes a request, if they say "Host: localhost:8080", then the
8080 will appear in r->parse_uri.port. Of course, they could also lie on
that port and the server wouldn't know any better.
I'm not exactly sure what the right answer to this is. Kind of a fundamental
problem with Apache not able to get a port number for "this server".
Ideas? Thoughts?
Cheers,
-g
--
Greg Stein, http://www.lyra.org/
Re: server->port busted
Posted by Doug MacEachern <do...@covalent.net>.
On Wed, 5 Dec 2001, Greg Stein wrote:
> The Port directive used to set the server->port variable. When Port was
> tossed, we also lost the use of server->port. That affects the response of
> ap_get_server_port() and ap_matches_request_vhost().
same problem when there was a Port directive and no Port directive was
configured. configuring ServerName foo:port will fix that.
i was told that was "the expected behavior" back when i posted this patch,
but it still applies..
Date: Thu, 9 Aug 2001 18:59:08 -0700 (PDT)
From: Doug MacEachern <do...@covalent.net>
To: new-httpd@apache.org
Subject: Listen vs. Port
Message-ID: <Pi...@mako.covalent.net>
if Listen is used to set the server port, and Port is not configured,
ap_get_server_port returns the default port (80). this breaks mod_dir
redirects if Listen is something other than 80. should Listen also set
the server->port (as in the patch below) or is it required that Port must
also be configured?
Index: server/listen.c
===================================================================
RCS file: /home/cvs/httpd-2.0/server/listen.c,v
retrieving revision 1.59
diff -u -r1.59 listen.c
--- server/listen.c 2001/07/26 16:36:40 1.59
+++ server/listen.c 2001/08/10 01:51:35
@@ -353,6 +353,10 @@
return "Port must be specified";
}
+ if (!cmd->server->port) {
+ cmd->server->port = port;
+ }
+
alloc_listener(cmd->server->process, host, port);
return NULL;