Case insensitive CGI search

Holger Weiss holger at CIS.FU-Berlin.DE
Sat Sep 10 18:21:35 CEST 2005


* Andreas Ericsson <ae at op5.se> [2005-09-10 17:30]:
> Holger Weiss wrote:
> >Just a minor request: IMO it would be nice to make the CGI hostname
> >search case insensitive, as the attached patch does.
>
> But the patch requires an absolute match, whereas the strstr() matching
> doesn't.

Note that "strstr(temp_host->name,host_name)==temp_host->name" is true
only if strstr() returns a pointer to the first char of temp_host->name.
Testing "strncmp(temp_host->name,host_name,strlen(host_name))" against 0
would have done essentially the same thing, and using strncasecmp() just
adds the case insensitivity.

In other words, no matter whether or not you use the patch, if "foobar"
is your only host beginning with "foo", it will be found by searching
"foo", but it won't be found by searching "bar".  The patch only adds
that "foobar" will also be found by search "Foo" or "FooBar".

Holger

-- 
PGP fingerprint:  F1F0 9071 8084 A426 DD59  9839 59D3 F3A1 B8B5 D3DE


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf




More information about the Developers mailing list