]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: htx: switch to case sensitive search of lower case header names
authorWilly Tarreau <w@1wt.eu>
Fri, 7 Dec 2018 10:38:03 +0000 (11:38 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 7 Dec 2018 12:25:59 +0000 (13:25 +0100)
Now that we know that htx only contains lower case header names, there
is no need anymore for looking them up in a case-insensitive manner.

Note that http_find_header() still does it because header names to
compare against may come from everywhere there.

src/proto_htx.c

index c613e72e2c8e782c1690cb51441de35decf416a4..c22908a14abf9bc53303c8a433b0eb9171005dd5 100644 (file)
@@ -4609,7 +4609,7 @@ void htx_check_request_for_cacheability(struct stream *s, struct channel *req)
                n = htx_get_blk_name(htx, blk);
                v = htx_get_blk_value(htx, blk);
 
-               if (isteqi(n, ist("Pragma"))) {
+               if (isteq(n, ist("pragma"))) {
                        if (v.len >= 8 && strncasecmp(v.ptr, "no-cache", 8) == 0) {
                                pragma_found = 1;
                                continue;
@@ -4618,13 +4618,13 @@ void htx_check_request_for_cacheability(struct stream *s, struct channel *req)
 
                /* Don't use the cache and don't try to store if we found the
                 * Authorization header */
-               if (isteqi(n, ist("Authorization"))) {
+               if (isteq(n, ist("authorization"))) {
                        txn->flags &= ~TX_CACHEABLE & ~TX_CACHE_COOK;
                        txn->flags |= TX_CACHE_IGNORE;
                        continue;
                }
 
-               if (!isteqi(n, ist("Cache-control")))
+               if (!isteq(n, ist("cache-control")))
                        continue;
 
                /* OK, right now we know we have a cache-control header */
@@ -4697,14 +4697,14 @@ void htx_check_response_for_cacheability(struct stream *s, struct channel *res)
                n = htx_get_blk_name(htx, blk);
                v = htx_get_blk_value(htx, blk);
 
-               if (isteqi(n, ist("Pragma"))) {
+               if (isteq(n, ist("pragma"))) {
                        if ((v.len >= 8) && strncasecmp(v.ptr, "no-cache", 8) == 0) {
                                txn->flags &= ~TX_CACHEABLE & ~TX_CACHE_COOK;
                                return;
                        }
                }
 
-               if (!isteqi(n, ist("Cache-control")))
+               if (!isteq(n, ist("cache-control")))
                        continue;
 
                /* OK, right now we know we have a cache-control header */