You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Ben Laurie <be...@gonzo.ben.algroup.co.uk> on 1996/10/22 17:46:31 UTC

Re: vhost problems?

Dean Gaudet wrote:
> 
> What ever became of those vhost problems Brian reported (the workaround
> was to use Port 80 in every vhost)?  I don't remember seeing any
> developments after my suggested fix.

Remind me ... what was your fix?

Cheers,

Ben.

-- 
Ben Laurie                  Phone: +44 (181) 994 6435
Freelance Consultant and    Fax:   +44 (181) 994 6472
Technical Director          Email: ben@algroup.co.uk
A.L. Digital Ltd,           URL: http://www.algroup.co.uk
London, England.            Apache Group member (http://www.apache.org)

Re: vhost problems?

Posted by Brian Behlendorf <br...@organic.com>.
On 22 Oct 1996, Dean Gaudet wrote:
> In article <ho...@gonzo.ben.algroup.co.uk>,
> Ben Laurie  <ne...@hyperreal.com> wrote:
> >Dean Gaudet wrote:
> >> 
> >> What ever became of those vhost problems Brian reported (the workaround
> >> was to use Port 80 in every vhost)?  I don't remember seeing any
> >> developments after my suggested fix.
> >
> >Remind me ... what was your fix?
> 
> The fix was to inherit the default port for each server_rec from the master
> server rec, or wherever else the global Port command is stored.  I'll include
> the original message because I was a bit more descriptive.  I'm still on the
> road or I'd try to do this now.

I never had a chance to try it out because I don't understand the code in that
area and didn't previously have the time to figure it out.  If someone else
wants to translate Dean's suggestion into code I've got a good test bed for the
bug.

	Brian

--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--
brian@organic.com  www.apache.org  hyperreal.com  http://www.organic.com/JOBS


Re: vhost problems?

Posted by Dean Gaudet <dg...@hotwired.com>.
In article <ho...@gonzo.ben.algroup.co.uk>,
Ben Laurie  <ne...@hyperreal.com> wrote:
>Dean Gaudet wrote:
>> 
>> What ever became of those vhost problems Brian reported (the workaround
>> was to use Port 80 in every vhost)?  I don't remember seeing any
>> developments after my suggested fix.
>
>Remind me ... what was your fix?

The fix was to inherit the default port for each server_rec from the master
server rec, or wherever else the global Port command is stored.  I'll include
the original message because I was a bit more descriptive.  I'm still on the
road or I'd try to do this now.

Dean

>From dgaudet Thu Oct  3 00:28:27 PDT 1996
From: dgaudet@hotwired.com (Dean Gaudet)
Subject: Re: more problems with Host:'s

In article <ho...@clotho.c2.org>,
 <ne...@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.