From: bel2125 Date: Tue, 2 Sep 2025 09:09:31 +0000 (+0200) Subject: Fix If-None-Match precedence (fixes caching problems for static content) X-Git-Url: https://git.feebdaed.xyz/?a=commitdiff_plain;h=26aa1ecf6e4f38dfdac43a44ba486341b048ffc3;p=0xmirror%2Fcivetweb.git Fix If-None-Match precedence (fixes caching problems for static content) Fixes #1342 --- 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; }