httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eli Marmor <mar...@netmask.it>
Subject Re: BUG: http_vhost.c:fix_hostname
Date Sun, 23 Jun 2002 08:18:13 GMT
Brian Pane wrote:
> 
> On Sat, 2002-06-22 at 13:56, Perry Harrington wrote:
> > There is a bug in fix_hostname.  The comment above function says that the hostname
> > is lowercased, but it's not.
> >
> > the line which reads:
> >
> >         *dst++ = *src++;
> ...
> > should read:
> >
> >         *dst++ = tolower(*src++);
> 
> Thanks, I'll commit a change to convert to lowercase.  All the virtual
> hosting code that uses r->hostname is case-insensitive, but IMHO it's
> better to normalize the case early to avoid surprising anyone who later
> tries to write, for example, a custom vhosting module based on a
> case-sensitive hash table.

The patch is needed, but I'm afraid it will be a bad idea to insert
"++" into tolower(), since under some platforms it is a macro (AND NOT
A FUNCTION!) defined by ctype.h, with more than 1 instance of the
parameter, so src ends up being incremented by 2, or 3, or even 4.

Maybe the following will be better:

	*dst++ = tolower(*src);
	++src;

-- 
Eli Marmor
marmor@netmask.it
CTO, Founder
Netmask (El-Mar) Internet Technologies Ltd.
__________________________________________________________
Tel.:   +972-9-766-1020          8 Yad-Harutzim St.
Fax.:   +972-9-766-1314          P.O.B. 7004
Mobile: +972-50-23-7338          Kfar-Saba 44641, Israel

Mime
View raw message