]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: http: fix improper parsing of HTTP methods for use with ACLs
authorWilly Tarreau <w@1wt.eu>
Fri, 29 Aug 2014 13:15:50 +0000 (15:15 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 29 Aug 2014 13:15:50 +0000 (15:15 +0200)
pat_parse_meth() had some remains of an early implementation attempt for
the patterns, it initialises a trash and never sets the pattern value there.
The result is that a non-standard method cannot be matched anymore. The bug
appeared during the pattern rework in 1.5, so this fix must be backported
there. Thanks to Joe Williams of GitHub for reporting the bug.

src/proto_http.c

index dc4787da034e386551ec4a494555f05ad7925536..f0dd0c83d7b920b2931b40b80f31b5d9620421df 100644 (file)
@@ -9851,20 +9851,13 @@ smp_prefetch_http(struct proxy *px, struct session *s, void *l7, unsigned int op
 static int pat_parse_meth(const char *text, struct pattern *pattern, int mflags, char **err)
 {
        int len, meth;
-       struct chunk *trash;
 
        len  = strlen(text);
        meth = find_http_meth(text, len);
 
        pattern->val.i = meth;
        if (meth == HTTP_METH_OTHER) {
-               trash = get_trash_chunk();
-               if (trash->size < len) {
-                       memprintf(err, "no space avalaible in the buffer. expect %d, provides %d",
-                                 len, trash->size);
-                       return 0;
-               }
-               pattern->ptr.str = trash->str;
+               pattern->ptr.str = (char *)text;
                pattern->len = len;
        }
        else {