]> git.feebdaed.xyz Git - 0xmirror/civetweb.git/commitdiff
Fix If-None-Match precedence (fixes caching problems for static content)
authorbel2125 <bel2125@gmail.com>
Tue, 2 Sep 2025 09:09:31 +0000 (11:09 +0200)
committerbel2125 <bel2125@gmail.com>
Tue, 2 Sep 2025 09:09:31 +0000 (11:09 +0200)
Fixes #1342

src/civetweb.c

index 0756b6d1af47bdc65133fca547d8ab0f0fdfed13..33ab8bd798c838bdbdf0b311b38ea3db05afcf94 100644 (file)
@@ -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;
 }