From 24ebef4e2d82e3f51b350b97e5397bd5b048d6cb Mon Sep 17 00:00:00 2001 From: Ryan Bloom Date: Wed, 6 Feb 2002 16:58:37 +0000 Subject: [PATCH] Be a bit more sane with regard to CanonicalNames. If the user has specified they want to use the CanonicalName, but they have not configured a port with the ServerName, then use the same port that the original request used. Submitted by: Ryan Bloom and Ken Coar git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93296 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 5 +++++ server/core.c | 9 ++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index 67afb2ae3ff..5afc480eb13 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,10 @@ Changes with Apache 2.0.32-dev + *) Be a bit more sane with regard to CanonicalNames. If the user has + specified they want to use the CanonicalName, but they have not + configured a port with the ServerName, then use the same port that + the original request used. [Ryan Bloom and Ken Coar] + *) In core_input_filter, check for an empty brigade after APR_BRIGADE_NORMALIZE(). Otherwise, we can get segfaults if a client says it will post some data but we get FIN before any diff --git a/server/core.c b/server/core.c index c55e114ac44..95e4f101911 100644 --- a/server/core.c +++ b/server/core.c @@ -799,10 +799,13 @@ AP_DECLARE(apr_port_t) ap_get_server_port(const request_rec *r) * Apache will use the hostname and port specified in the * ServerName directive to construct a canonical name for the * server. (If no port was specified in the ServerName - * directive, Apache implies port 80 for http:// and - * port 443 for https://) + * directive, Apache uses the port supplied by the client if + * any is supplied, and finally the default port for the protocol + * used. */ - port = r->server->port ? r->server->port : ap_default_port(r); + port = r->server->port ? r->server->port : + r->connection->local_addr->port ? r->connection->local_addr->port : + ap_default_port(r); } /* default */ -- 2.47.3