]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: samples: Handle the type SMP_T_METH in smp_is_safe and smp_is_rw
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 24 Jul 2017 14:07:12 +0000 (16:07 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 24 Jul 2017 15:16:00 +0000 (17:16 +0200)
For all known methods, samples are considered as safe and rewritable. For
unknowns, we handle them like strings (SMP_T_STR).

include/proto/sample.h

index 4319278a9c0192589401d1b1d61736b1f72f87dd..94226d2d5e049648a62261ee0ed19f83b1f68041 100644 (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 ||