From 26aa1ecf6e4f38dfdac43a44ba486341b048ffc3 Mon Sep 17 00:00:00 2001 From: bel2125 Date: Tue, 2 Sep 2025 11:09:31 +0200 Subject: [PATCH] Fix If-None-Match precedence (fixes caching problems for static content) Fixes #1342 --- src/civetweb.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/civetweb.c b/src/civetweb.c index 0756b6d1..33ab8bd7 100644 --- a/src/civetweb.c +++ b/src/civetweb.c @@ -10783,9 +10783,13 @@ is_not_modified(const struct mg_connection *conn, const char *inm = mg_get_header(conn, "If-None-Match"); construct_etag(etag, sizeof(etag), filestat); - return ((inm != NULL) && !mg_strcasecmp(etag, inm)) - || ((ims != NULL) - && (filestat->last_modified <= parse_date_string(ims))); + if (inm) { + return !mg_strcasecmp(etag, inm); + } + if (ims) { + return (filestat->last_modified <= parse_date_string(ims)); + } + return 0; } -- 2.43.0