Sfoglia il codice sorgente

Fix If-None-Match precedence (fixes caching problems for static content)

Fixes #1342
bel2125 4 giorni fa
parent
commit
26aa1ecf6e
1 ha cambiato i file con 7 aggiunte e 3 eliminazioni
  1. 7 3
      src/civetweb.c

+ 7 - 3
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;
 }