httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dean Gaudet <>
Subject Re: solution to 'mod_rewrite.c wierdness' => mod_dir.c
Date Thu, 22 Jan 1998 23:45:34 GMT
I've changed my mind somewhat on this topic... and I'm for this
functionality now.  But I think you're going to have to remind everyone
just why you need it -- it's for the cool "virtual" vhosts right?  vhosts
which not only are name-based, but don't even have a <VirtualHost>

I think you've got one glitch still.  I think construct_url should look
like this: 

char *construct_url(pool *p, const char *uri, const request_rec *r)
    return pstrcat (p, "http://",
	construct_server(p, r->hostname ? r->hostname
					: r->server->server_hostname,
				? ntohs(r->connection->local_addr.sin_port)
				: r->server->port),
			uri, NULL);

My reasoning for the port logic there goes like this: if the client
didn't send a Host: header then we want to use the "canonical" name
for the server (which is r->server->server_hostname:r->server->port).
If the client did specify a Host: header then we should give them back
the Host: header and the port they came in on.

Note the latter is a slight anomaly, but it's actually the way the vhost
code works -- we believe the port the request came in on rather than
the port specified in the Host: header, and you can see the logic for
that in check_hostalias() in main/http_vhost.c.

We have a few PRs that mention that SERVER_PORT isn't set to the port
the user came in on.  I'm not sure what to do about that at the moment.

And we should emphasize that this does change the default behaviour --
and there may be compatibility problems... but I'm having a hard time
imagining them right now.  It would not be much more effort to have
a per-server core setting which controls whether all responses are
"canonical" or "adaptive".

So in short, this is a great start.


View raw message