Re: [PATCH] URL handling bugs

From: Alex Rousskov <rousskov_at_measurement-factory.com>
Date: Wed, 18 May 2011 10:09:37 -0600

On 05/18/2011 10:00 AM, Amos Jeffries wrote:

>>> This canonical change has been discussed previously. There is one other
>>> incorrect setting of HttpRequest::canonical in icap/ModXact.cc, but that
>>> must handle a const input which urlCanonical() function does not yet
>>> handle.
>>
>> To fix that, urlCanonical(request) should become a constant HttpRequest
>> method. Is there an XXX about this in icap/ModXact.cc? If not, please
>> add.
>
> I'm not so sure. Making it constant voids the caching speed benefit. The
> existing xstrdup() is fine in the name of speed.

The HttpRequest::urlCanonical() method should be constant. The canonical
data member should be mutable (because it is just a cached computed
value). Thus, urlCanonical() can compute canonical value if needed (and
other HttpRequest methods can clear canonical if needed). This way you
get both const-correctness and caching speed.

HTH,

Alex.
Received on Wed May 18 2011 - 16:10:00 MDT

This archive was generated by hypermail 2.2.0 : Thu May 19 2011 - 12:00:04 MDT