Re: [xml] Why the strncasecmp() avoidance?

Date view Thread view Subject view Author view

From: Daniel Veillard (Daniel.Veillard@w3.org)
Date: Fri Sep 22 2000 - 02:31:01 EDT


On Thu, Sep 21, 2000 at 03:02:48PM -0700, Wayne Davison wrote:
> This is along the same line as the recent comment about xmlHasProp() being
> case-sensitive.

  Hi Wayne,

 yes sorry, I'm behind on e-mail, having travelled/had meeting most of the
week. I will try to resynch this week-end.

> For some time now I've noticed that the HTML/HTTP-parsing
> code often only allows certain configurations of upper/lower-case in
> various tags and headers. For instance, the nano-HTTP code does not match
> the "Content-type:" header that comes back from Netscape-Enterprise/3.6
> SP2 because it only allows 2 variations to match ("Content-Type:" and
> "content-type:", not counting the ones without the dash in the middle).
> Something similar happens in all the tag-matching code (such as only
> looking for "HTTP-EQUIV", "Http-Equiv", and "http-equiv" on META tags).

  Right, agreed. This is far from the Right Way ...

> Thus my question is, why doesn't the code use strncasecmp() for this kind
> of thing? I know that older machines may not have an implementation of
> this routine, and that it may not handle non-ASCII charsets, but these are
> soluble problems (i.e. I have an implementation of strncasecmp() that can
> be included in libxml, and we only need to use it to compare ASCII strings).

  yes that's the reason. The linux man page says
  CONFORMING TO
         BSD 4.3

only. This mean lot of target may not have it, and the reason why I didn't
used it.

> So, shall I jump in and change a bunch of code to use strncasecmp()? Or
> shall I hard-wire the code to use an internal xmlStrncasecmp() routine in
> all instances? (Which would alleviate concerns about some versions of
> strncasecmp() out there not working properly.) Or is there some other
> solution to this problem?

  I see no problem if you provide xmlStrncasecmp(), yes go ahead !

> In the meantime, the appended patch makes the nano-HTTP parser understand
> the Content-type header.

 I would prefer an xmlStrcasecmp patch if you have time.

Daniel

-- 
Daniel.Veillard@w3.org | W3C, INRIA Rhone-Alpes  | Today's Bookmarks :
Tel : +33 476 615 257  | 655, avenue de l'Europe | Linux XML libxml WWW
Fax : +33 476 615 207  | 38330 Montbonnot FRANCE | Gnome rpm2html rpmfind
 http://www.w3.org/People/all#veillard%40w3.org  | RPM badminton Kaffe
----
Message from the list xml@rpmfind.net
Archived at : http://xmlsoft.org/messages/
to unsubscribe: echo "unsubscribe xml" | mail  majordomo@rpmfind.net


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Fri Sep 22 2000 - 02:44:16 EDT