]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: cache: Inverted variables in http_calc_maxage function
authorRemi Tricot-Le Breton <rlebreton@haproxy.com>
Fri, 30 Oct 2020 13:26:13 +0000 (14:26 +0100)
committerWilliam Lallemand <wlallemand@haproxy.org>
Fri, 30 Oct 2020 13:29:29 +0000 (14:29 +0100)
The maxage and smaxage variables were inadvertently assigned the
Cache-Control s-maxage and max-age values respectively when it should
have been the other way around.

This can be backported on all branches after 1.8 (included).

src/cache.c

index a73f2668f1ee3f6c9abed0c5eb9c054cf7fbcf96..f86c96f097793bc8ec41d8e676f56131b0d36f2a 100644 (file)
@@ -495,7 +495,7 @@ int http_calc_maxage(struct stream *s, struct cache *cache)
 
                        chunk_strncat(chk, value, ctx.value.len - 8 + 1);
                        chunk_strncat(chk, "", 1);
-                       maxage = atoi(chk->area);
+                       smaxage = atoi(chk->area);
                }
 
                value = directive_value(ctx.value.ptr, ctx.value.len, "max-age", 7);
@@ -504,7 +504,7 @@ int http_calc_maxage(struct stream *s, struct cache *cache)
 
                        chunk_strncat(chk, value, ctx.value.len - 7 + 1);
                        chunk_strncat(chk, "", 1);
-                       smaxage = atoi(chk->area);
+                       maxage = atoi(chk->area);
                }
        }