You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Dean Gaudet <dg...@arctic.org> on 1998/02/05 22:04:20 UTC

minor API change

I'd like to require something that's just happened by convention so far... 
I'd like to require that the strings used for
content_{encoding,type,languages} in request_recs be all lower case. These
are all case-insensitive strings. 

Presently it's just by luck that we haven't had a bug in mod_negotiation. 
It does stuff like this: 

            mime_info.content_encoding = sub_req->content_encoding;
            str_tolower(mime_info.content_encoding);

But if you look in mod_mime you'll see that r->content_encoding is set to
the value determined at config time.  i.e. this str_tolower() is modifying
a config time *constant*.  This is a no-no in my books.  (It causes at
least 1 extra page to become unshared between all children.) 

We'd either have to change mod_negotiation to use strcasecmp everywhere
(slow).  Or it would have to pstrdup() before doing str_tolower() (slow,
waste of memory).  Or mod_mime would have to pstrdup() in all cases (slow,
waste of memory). 

Or we could just require that modules ensure that they use all lower case
strings when modifying the r->content_foo members.

Dean



Re: minor API change

Posted by Dean Gaudet <dg...@arctic.org>.
I think my toy project for the rest of this week is going to be a
verify_request_rec_sanity() function.  For debugging purposes only.  It
will verify all the constraints that are explicit or implicit in our API
(well at least the ones I can verify easily).  I'll create a generic
APACHE_DEBUG define which turns on these sanity checks.

Then I'll see how many sparks fly when I turn it on. 

Dean

On Thu, 5 Feb 1998, Dean Gaudet wrote:

> I'd like to require something that's just happened by convention so far... 
> I'd like to require that the strings used for
> content_{encoding,type,languages} in request_recs be all lower case. These
> are all case-insensitive strings. 
> 
> Presently it's just by luck that we haven't had a bug in mod_negotiation. 
> It does stuff like this: 
> 
>             mime_info.content_encoding = sub_req->content_encoding;
>             str_tolower(mime_info.content_encoding);
> 
> But if you look in mod_mime you'll see that r->content_encoding is set to
> the value determined at config time.  i.e. this str_tolower() is modifying
> a config time *constant*.  This is a no-no in my books.  (It causes at
> least 1 extra page to become unshared between all children.) 
> 
> We'd either have to change mod_negotiation to use strcasecmp everywhere
> (slow).  Or it would have to pstrdup() before doing str_tolower() (slow,
> waste of memory).  Or mod_mime would have to pstrdup() in all cases (slow,
> waste of memory). 
> 
> Or we could just require that modules ensure that they use all lower case
> strings when modifying the r->content_foo members.
> 
> Dean
> 
> 
>