MINOR: samples: Handle the type SMP_T_METH in smp_is_safe and smp_is_rw

For all known methods, samples are considered as safe and rewritable. For
unknowns, we handle them like strings (SMP_T_STR).
This commit is contained in:
Christopher Faulet 2017-07-24 16:07:12 +02:00 committed by Willy Tarreau
parent ec10051349
commit 5db105e8b2
1 changed files with 10 additions and 0 deletions

View File

@ -86,6 +86,11 @@ static inline
int smp_is_safe(struct sample *smp)
{
switch (smp->data.type) {
case SMP_T_METH:
if (smp->data.u.meth.meth != HTTP_METH_OTHER)
return 1;
/* Fall through */
case SMP_T_STR:
if ((smp->data.u.str.len < 0) ||
(smp->data.u.str.size && smp->data.u.str.len >= smp->data.u.str.size))
@ -133,6 +138,11 @@ int smp_is_rw(struct sample *smp)
return 0;
switch (smp->data.type) {
case SMP_T_METH:
if (smp->data.u.meth.meth != HTTP_METH_OTHER)
return 1;
/* Fall through */
case SMP_T_STR:
if (!smp->data.u.str.size ||
smp->data.u.str.len < 0 ||