httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dgau...@hotwired.com (Dean Gaudet)
Subject Re: more problems with Host:'s
Date Thu, 03 Oct 1996 07:28:26 GMT
In article <hot.mailing-lists.new-httpd-199610011743.KAA29780@clotho.c2.org>,
 <new-httpd@hyperreal.com> wrote:
>> 
>> I think we need to find out why Alexei made that change in the first
>> place... is he around somewhere?
>
>	There was a problem where port-based virtual hosts were
>causing a problem:
>
>Port 80
>Listen 80
>Listen 443
>[normal config]
>
><VirtualHost *:443>
>port 443 config
></VirtualHost>
>
>	The port 443 config was used for port 80 connections.

Right, now I remember you and Ben talking about that and the patch was
something like this:

+  int port = (*r->hostname) ? atoi(r->hostname) : 80;
-  int port = (*r->hostname) ? atoi(r->hostname) : 0;

A 0 port has the following meanings (depending on where in the code you are):

    - any port
    - the global Port (i.e. Port 80 in sameer's config)
    - port 80

Which is beginning to sound pretty hopeless.  I believe the fault was
in adding the "any port" meaning to it, which occured somewhere around
1.1.  Specifically, I think the Listen directive brought in that meaning.

Here's two suggested approaches to properly fix this:

- add a port -1 which becomes the wildcard port

- pass the global server_conf in as a parm to get_addresses and use it
    to set sar->host_port when the name has no :port tacked on.
    (You also probably should fix get_virthost_addr which get_addresses
    descended from when I did the multi-ip patch.)  Leave 0 as the
    wildcard port.

I'm partial to the second fix because I think of the global Port statement
as meaning "pretend the HTTP specification says port N instead of 80".

It has the implication that if a config looks like this:

    Port 1111
    <VirtualHost A>
    ...
    </VirtualHost>
    Port 2222
    <VirtualHost B>
    ...
    </VirtualHost>

Then A and B will live on different ports.  But I think this is intuitive.

It breaks people using multiple Listens and expecting :* behaviour when
they don't specify any port.

Can someone try this?  I'm way too busy... and am leaving for 3 weeks
starting monday.  It should work since Brian said putting "Port 80" in
each of his vhosts made things work right.

Brian asked if we should sit down and rethink the whole server selection
process... we should.  But I doubt we can fit it in for 1.2.  Here's
my input:

- global Port becomes the default for any unspecified :port
- never select a server unless the ip is in the addrs list
    (remember we have a bug here right now)
- never select a server unless the port matches
- servers appearing earlier in the config file override servers appearing
    later if there is a conflict (presently it's opposite)

Dean

P.S. Anyone else love indirection like server_addr_rec ***paddr
in get_addresses?  Pointer to pointer has a mathematical elegance.
I remember hating Pascal in school because linked list and tree
manipulations were needlessly complicated by the lack of an address-of
operator.

Mime
View raw message