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)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 3 Nov 2020 15:18:25 +0000 (16:18 +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).

(cherry picked from commit 8c2db71326addbcf9d6c8ae4d2048247031f9e4c)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 2185f7e2b809889310efdf087da6777583607597)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>

src/cache.c

index ddfd1b0..9ae056c 100644 (file)
@@ -496,7 +496,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);
@@ -505,7 +505,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);
                }
        }