You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apache-bugdb@apache.org by Alex Tutubalin <le...@lexa.ru> on 1997/08/23 18:10:01 UTC

general/1049: 'software' VirtualHost do not work with portnumber differ, than specified in 'Port' directive

>Number:         1049
>Category:       general
>Synopsis:       'software' VirtualHost do not work with portnumber differ, than specified in 'Port' directive
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    apache (Apache HTTP Project)
>State:          open
>Class:          sw-bug
>Submitter-Id:   apache
>Arrival-Date:   Sat Aug 23 09:10:01 1997
>Originator:     lexa@lexa.ru
>Organization:
apache
>Release:        1.2.4
>Environment:
uname -a: FreeBSD home.lexa.ru 3.0-970807-SNAP FreeBSD 3.0-970807-SNAP #0:
Compiler: gcc version 2.7.2.1
>Description:
Say, I've following setup:
in DNS files:
xxx IN A 1.2.3.4
yyy IN CNAME xxx

in httpd.conf:
Port 80
Listen 80
Listen 8000
Listen 8001
DocumentRoot /www/ht-xxx
<VirtualHost yyy:*>
DocumentRoot /www/ht-yyy
</VirtualHost>

In this case, when I'm accessing URL http://xxx:80 or http://yyy:80
with Netscape Navigator, I'll get right document. 
But when I'm accessing URL http://yyy:8000,
I'll get document with URL http://xxx:8000.


Source of problem:

Netscape set Host: header in HTTP-request to hostname:port
(of course, if port specified in URL string). 

In file http_protocol.c, in function check_hostalias, line 715-716
we can see:
  if (port && (port != r->server->port))
    return;
where port - portnumber, given from Host: header.
In this case, check_hostalias not performs any hostalias/virtualhost
checks and main server context (or default Virtual host) is assumed. 
>How-To-Repeat:
Sorry, I have no test-server on-line. You can repeat this bug
by using example config given above.
>Fix:
Comment out piece of code, described above (lines 715-716 in
http_protocol.c%2
>Audit-Trail:
>Unformatted: