You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Roy T. Fielding" <fi...@liege.ICS.UCI.EDU> on 1996/11/12 06:41:46 UTC

Re: WWW Form Bug Report: "osf/1 virtualhost support by ip broken" on OSF/1

Could someone with virtual hosts please test this change and commit it?
Two people have reported the same fix, and it seems obvious that the
existing code is silly, but I don't like committing what I can't test
at all.  The only real question is whether other compilers will complain
about casting a negative number to an unsigned long.

....Roy
================================================================
>>Submitter: brett@speakeasy.org
>>Operating system: OSF/1, version: 
>>Version of Apache Used: 1.1.1
>>Extra Modules used: 
>>URL exhibiting problem: 
>>
>>Symptoms:
>>--
>>Access to virtual hosts by ip returns main server
>>page, unless the Host header is given.
>>The problem is in util.c, in the function
>>get_virthost_addr, on line 1019:
>>
>>    if (my_addr != ((unsigned long) 0xffffffff))
>>
>>I changed 0xffffffff to -1, and it works.  


Re: WWW Form Bug Report: "osf/1 virtualhost support by ip broken" on OSF/1

Posted by Dean Gaudet <dg...@hotwired.com>.
In article <ho...@paris.ics.uci.edu>,
Roy T. Fielding <ne...@hyperreal.com> wrote:
>Could someone with virtual hosts please test this change and commit it?

Well, under bsdi, irix, and linux you can use INADDR_NONE.  Under solaris
the man page even says the functions (inet_addr, inet_network) return -1
on error (despite returning unsigned long).  Casting -1 to an unsigned
long should work on any compiler pretending to be ansi, as should using
the constant ~0ul.

On the other hand, the newer inet_aton avoids this problem by not
overloading the return value.

Dean

>Two people have reported the same fix, and it seems obvious that the
>existing code is silly, but I don't like committing what I can't test
>at all.  The only real question is whether other compilers will complain
>about casting a negative number to an unsigned long.
>
>....Roy
>================================================================
>>>Submitter: brett@speakeasy.org
>>>Operating system: OSF/1, version: 
>>>Version of Apache Used: 1.1.1
>>>Extra Modules used: 
>>>URL exhibiting problem: 
>>>
>>>Symptoms:
>>>--
>>>Access to virtual hosts by ip returns main server
>>>page, unless the Host header is given.
>>>The problem is in util.c, in the function
>>>get_virthost_addr, on line 1019:
>>>
>>>    if (my_addr != ((unsigned long) 0xffffffff))
>>>
>>>I changed 0xffffffff to -1, and it works.  
>