[Mono-dev] Reverted patch 55895

Ben Maurer bmaurer at ximian.com
Sun Jan 22 15:03:24 EST 2006

On Sun, 2006-01-22 at 14:28 -0500, Miguel de Icaza wrote:
>    My suggestion is that you add at the end of the routine a call to
> capitalize the string properly, so if we fail to find a match for a
> string, say "content-lenght", it then capitalizes it properly and tries
> the switch again (there is one special case to handle, header "TE", but
> that is all).

Actually, for the case insensitive path, I'd just use a hashtable (with
a case-insensitive hashcode). That avoids *any* allocations (and avoids
a linear search which one would get with using String.Compare).

I'm not sure if this routine is performance critical enough to justify
having two hashtables, one for a faster case sensitive compare and
another for a correct insensitive comparison.

In general, we shouldn't use ToLower/ToUpper for the purpose of case
insensitive comparisons.

-- Ben

More information about the Mono-devel-list mailing list