Re: [PATCH] URL handling bugs

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Thu, 19 May 2011 11:50:42 +1200

 On Wed, 18 May 2011 10:09:37 -0600, Alex Rousskov wrote:
> 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.
>

 Oh, forgot mutable. Thanks.

 Amos
Received on Wed May 18 2011 - 23:50:44 MDT

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