Parcourir la source

Quick fix for files in memory (#382)

bel il y a 8 ans
Parent
commit
194aa4ebf5
1 fichiers modifiés avec 6 ajouts et 0 suppressions
  1. 6 0
      src/civetweb.c

+ 6 - 0
src/civetweb.c

@@ -3663,6 +3663,12 @@ mg_stat(const struct mg_connection *conn,
 	if (conn && is_file_in_memory(conn, path)) {
 	if (conn && is_file_in_memory(conn, path)) {
 		/* filep->is_directory = 0; filep->gzipped = 0; .. already done by
 		/* filep->is_directory = 0; filep->gzipped = 0; .. already done by
 		 * memset */
 		 * memset */
+
+		/* Quick fix (for 1.9.x): */
+		/* mg_stat must fill all fields, also for files in memory */
+		open_file_in_memory(conn, path, filep, MG_FOPEN_MODE_NONE);
+		/* TODO: for 1.10: restructure how files in memory are handled */
+
 		filep->last_modified = time(NULL); /* xxxxxxxx */
 		filep->last_modified = time(NULL); /* xxxxxxxx */
 		/* last_modified = now ... assumes the file may change during runtime,
 		/* last_modified = now ... assumes the file may change during runtime,
 		 * so every mg_fopen call may return different data */
 		 * so every mg_fopen call may return different data */