Hi Vincent and Willy,
Le 09/03/2012 01:51, Willy Tarreau a écrit :
Hi Vincent,
On Wed, Mar 07, 2012 at 06:16:32PM +0100, Vincent Bernat wrote:
When enabling/disabling a server with POST to the stats page, the
order of the required params is important: the server name had to be
first. This patch allows to handle those parameters in any order.
looks good, will check this tomorrow when I have my eyeballs wider
opened.
I didn't have time to test the patch yet, but for me this will keep some
side effects : depending on the parameters order, this will skip some
servers.
Example :
?s=server1&b=backend&action=disable&s=server2&s=server3
With the patch, I think "server3" will be ignored.
When writing this part of code, the order dependency was not considered
as a bug but as an "optimization" instead :
- the stats page form provides the parameters in that order.
- the query string is parsed from right to left to only remember the
last value for parameters "action" and "b" (in case someone provides
several ones).
If we want to break the order dependency, we should think of a more
complete patch, for example using a 2 pass parsing (1st pass to find
"action" and "b" parameters, 2nd pass to apply them to the servers) :
- to prevent memory allocation
- to take into account every "s" parameters
- of course, it can be optimized to prevent the 2nd pass if the
parameters are already ordered.
--
Cyril Bonté