atom feed41 messages in org.apache.tomcat.devRe: Spec question: RE BUG 12052
FromSent OnAttachments
Bojan SmojverAug 28, 2002 6:26 am 
Craig R. McClanahanAug 28, 2002 9:14 am 
John TrollingerAug 28, 2002 9:18 am 
Craig R. McClanahanAug 28, 2002 9:41 am 
cost...@covalent.netAug 28, 2002 10:03 am 
John TrollingerAug 28, 2002 10:21 am 
Costin ManolacheAug 28, 2002 10:35 am 
Craig R. McClanahanAug 28, 2002 10:54 am 
Craig R. McClanahanAug 28, 2002 10:59 am 
Ignacio J. OrtegaAug 28, 2002 11:24 am 
Ryan LubkeAug 28, 2002 11:28 am 
Bill BarkerAug 28, 2002 11:28 am 
cost...@covalent.netAug 28, 2002 12:52 pm 
Costin ManolacheAug 28, 2002 1:52 pm 
Costin ManolacheAug 28, 2002 1:54 pm 
Ignacio J. OrtegaAug 28, 2002 2:05 pm 
Ryan LubkeAug 28, 2002 3:52 pm 
cost...@covalent.netAug 28, 2002 4:11 pm 
Bojan SmojverAug 28, 2002 4:22 pm 
Bojan SmojverAug 28, 2002 4:45 pm 
cost...@covalent.netAug 28, 2002 5:01 pm 
Bill BarkerAug 28, 2002 5:43 pm 
cost...@covalent.netAug 28, 2002 7:11 pm 
Bojan SmojverAug 28, 2002 8:22 pm 
Bojan SmojverAug 28, 2002 11:45 pm 
Bill BarkerAug 29, 2002 12:24 am 
Ignacio J. OrtegaAug 29, 2002 6:48 am 
cost...@covalent.netAug 29, 2002 7:29 am 
Craig R. McClanahanAug 29, 2002 8:12 am 
Ryan LubkeAug 29, 2002 9:01 am 
Costin ManolacheAug 29, 2002 9:56 am 
Bojan SmojverAug 29, 2002 4:10 pm 
Ignacio J. OrtegaAug 30, 2002 6:50 am 
cost...@covalent.netAug 30, 2002 7:53 am 
Ignacio J. OrtegaAug 30, 2002 10:14 am 
cost...@covalent.netAug 30, 2002 10:53 am 
Ignacio J. OrtegaAug 30, 2002 11:26 am 
cost...@covalent.netAug 30, 2002 11:49 am 
Steve DowneyAug 30, 2002 1:27 pm 
Ignacio J. OrtegaAug 30, 2002 1:46 pm 
Bojan SmojverAug 30, 2002 5:55 pm 
Subject:Re: Spec question: RE BUG 12052
From:cost...@covalent.net (cost@covalent.net)
Date:Aug 28, 2002 5:01:26 pm
List:org.apache.tomcat.dev

I think the decision to use the Host header is right, but I agree that it violates the wording in the servlet spec.

The SERVER_PORT and the port in the Host: header are different beasts - in most use cases I've seen the user is interested in the second.

Note that a load balancer or proxy is required ( AFAIK ) to insert Host: headers if none is present.

Costin

On 29 Aug 2002, Bojan Smojver wrote:

On Thu, 2002-08-29 at 04:28, Bill Barker wrote:

The question in 12052 is whether Apache should use the socket port (as it does now), or the port in the Host header. When this came up with the Coyote/Http11 connector, the decision was that the Host header was the correct one. I'd have to say that the bug is valid.

This is what the API (2.2) docs say about the getServerPort():

---------------- Returns the port number on which this request was received. For HTTP servlets, same as the value of the CGI variable SERVER_PORT. ----------------

This in itself could be contradicting, but I think that in the case of Apache it is pretty straightforward.

This is what Apache 2.0 does to populate the variable SERVER_PORT:

---------------- apr_table_addn(e, "SERVER_PORT", apr_psprintf(r->pool, "%u", ap_get_server_port(r))); ----------------

And this is the ap_get_server_port():

---------------- AP_DECLARE(apr_port_t) ap_get_server_port(const request_rec *r) { apr_port_t port; core_dir_config *d = (core_dir_config *)ap_get_module_config(r->per_dir_config, &core_module);

if (d->use_canonical_name == USE_CANONICAL_NAME_OFF || d->use_canonical_name == USE_CANONICAL_NAME_DNS) {

/* With UseCanonicalName off Apache will form self-referential * URLs using the hostname and port supplied by the client if * any are supplied (otherwise it will use the canonical name). */ port = r->parsed_uri.port ? r->parsed_uri.port : r->server->port ? r->server->port : ap_default_port(r); } else { /* d->use_canonical_name == USE_CANONICAL_NAME_ON */

/* With UseCanonicalName on (and in all versions prior to 1.3) * 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 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 : r->connection->local_addr->port ? r->connection->local_addr->port ap_default_port(r); }

/* default */ return port; } ----------------

This doesn't seem like coming from headers, but rather from URL or as indicated by the server itself. What do you think?

Bojan