[squid-dev] [PATCH] VIA creation code duplication
Eduard Bagdasaryan
eduard.bagdasaryan at measurement-factory.com
Thu Mar 16 11:46:34 UTC 2017
I would avoid using magic numbers like 64*1024.
If you are sure that this check is much better/informative,
consider making String::SizeMax_ public and use it instead.
Eduard.
On 16.03.2017 14:15, Amos Jeffries wrote:
> On 16/03/2017 11:03 p.m., Eduard Bagdasaryan wrote:
>> If throwing when String exceeds its 64K limit is
>> acceptable then why not just use my previous t2 patch?
>> HttpHeader::addVia() calls strListAdd() similarly as the old
>> did: it throws if str->canGrowBy(itemSize) returns false.
>>
> I was hoping not to need a Must() at all. We still have the option of
> passing buf instead of strVia to putStr().
>
>
> Also, compare the information content of the exception messages:
>
> Exception: str->canGrowBy(2)
>
> Exception: str->canGrowBy(itemSize)
>
> Exception: strVia.length() > 64*1024
>
>
> If one was presented with only one of them. How would one go about
> replicating the traffic to debug and fix it?
>
> Only the latter offers the chance of a few minutes turnaround on a fix
> if the Must() is acually hit in production traffic.
>
> (I kind of hate those low-level operations with Must() and assert() like
> the former - far too little context to be useful debugging with such big
> impact when they are triggered.)
>
> Amos
>
> _______________________________________________
> squid-dev mailing list
> squid-dev at lists.squid-cache.org
> http://lists.squid-cache.org/listinfo/squid-dev
More information about the squid-dev
mailing list