httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Ruggeri <DRugg...@primary.net>
Subject Re: id=51247 Enhance mod_proxy and _balancer with worker status flag to only accept sticky session routes
Date Wed, 25 May 2011 19:54:54 GMT
On 5/25/2011 5:41 AM, Mladen Turk wrote:
> On 05/25/2011 02:27 AM, Daniel Ruggeri wrote:
>> I attached the patch to a bug opened by Cameron Stokes
>> https://issues.apache.org/bugzilla/show_bug.cgi?id=48841
>>
>
> Just a quick note on the first thing I saw:
>
> + //worker->lbfactor = atoi(val);
> + worker->lbfactor = strtol(val, NULL, 10);
> + if (errno == EINVAL || worker->lbfactor < 0 || worker->lbfactor > 100)
>
> You should add
> errno = 0;
> before strtol call if you inspect the errno afterwards.
> BTW, what's wrong with the atoi call? We ain't gonna have 64-bit lbfactors,
> and the acceptable range is 0 ... 100
> Also, don't use C++ comments.
>
>
> Regards

Sorry about the comment, that was supposed to be removed.

I mentioned the following in the notes when I brought up the topic of 
the patch on the list some months back. I believe my intent was to allow 
setting lbfactor to zero at start time if desired and to prevent a 
'parse error' from causing an invalid value to be treated as zero instead.

Patch notes from Oct on list (sorry this never made it into the bug 
report - can add if desired):
    I used a constant called PROXY_WORKER_NOLBFACTOR in mod_proxy.h and 
changed the atoi call during configuration to strtol since the atoi call 
returns 0 both during error situations and when the proper value to 
return is 0. Also, the existing checks had to be refactored a little 
since (at least on the SUN c compiler) an  uninitialized integer is the 
same as `0'. Aside from that, only the bybusiness algorithm had to be 
modified to avoid a divide by zero error.

-- 
--
Daniel Ruggeri

Mime
View raw message