Prechádzať zdrojové kódy

Fix #204: Memory mapped files must not return 1970-01-01 as modification date

bel 9 rokov pred
rodič
commit
8fbe05852a
1 zmenil súbory, kde vykonal 9 pridanie a 0 odobranie
  1. 9 0
      src/civetweb.c

+ 9 - 0
src/civetweb.c

@@ -2666,6 +2666,15 @@ mg_stat(struct mg_connection *conn, const char *path, struct file *filep)
 	memset(filep, 0, sizeof(*filep));
 
 	if (conn && is_file_in_memory(conn, path, filep)) {
+		/* filep->is_directory = 0; filep->gzipped = 0; .. already done by
+		 * memset */
+		last_modified = time(NULL);
+		/* last_modified = now ... assumes the file may change during runtime,
+		 * so every mg_fopen call may return different data */
+		/* last_modified = conn->ctx.start_time;
+		 * May be used it the data does not change during runtime. This allows
+		 * browser caching. Since we do not know, we have to assume the file
+		 * in memory may change. */
 		return 1;
 	}