Kaynağa Gözat

Remove "file in memory" from the interface

TODO: remove implementation as well
bel2125 7 yıl önce
ebeveyn
işleme
901cd541c5
2 değiştirilmiş dosya ile 14 ekleme ve 31 silme
  1. 14 4
      docs/Interface_Changes_1.10.md
  2. 0 27
      include/civetweb.h

+ 14 - 4
docs/Interface_Changes_1.10.md

@@ -45,12 +45,22 @@ when using mg\_websocket\_write.
 
 #### S3: open\_file member of mg\_callbacks
 
-This member is going to be removed.
-It is superseeded by mg\_add\_request\_handler.
+Memory mapped files are a relic from before `mg_set_request_handler`
+was introduced in CivetWeb 1.4 (September 2013).
+Is "file in memory" still a useful feature or dead code? See this
+[discussion](https://groups.google.com/forum/#!topic/civetweb/h9HT4CmeYqI).
+Since it is not widely used, and a burden in maintenance, the
+"file in memory" should be completely removed, including removing
+the open\_file member of mg\_callbacks.
+
 
 **Compatibility considerations:**
-Current code using open\_file needs to be changed.
-Instructions how to do this will be provided.
+Removing "file in memory" will require code using open\_file to be changed.
+A possible replacement by mg\_set\_request\_handler is sketched in
+[this comment](https://github.com/civetweb/civetweb/issues/440#issuecomment-290531238).
+
+**Required Actions:**
+Modify code using open\_file by using request handlers.
 
 
 #### S4: Support multiple hostnames and SNI

+ 0 - 27
include/civetweb.h

@@ -309,33 +309,6 @@ struct mg_callbacks {
 	*/
 	void (*connection_close)(const struct mg_connection *);
 
-#if defined(MG_USE_OPEN_FILE)
-	/* Note: The "file in memory" feature is a deletion candidate, since
-	 * it complicates the code, and does not add any value compared to
-	 * "mg_add_request_handler".
-	 * See this discussion thread:
-	 * https://groups.google.com/forum/#!topic/civetweb/h9HT4CmeYqI
-	 * If you disagree, if there is any situation this is indeed useful
-	 * and cannot trivially be replaced by another existing feature,
-	 * please contribute to this discussion during the next 3 month
-	 * (till end of April 2017), otherwise this feature might be dropped
-	 * in future releases. */
-
-	/* Called when civetweb tries to open a file. Used to intercept file open
-	   calls, and serve file data from memory instead.
-	   Parameters:
-	      path:     Full path to the file to open.
-	      data_len: Placeholder for the file size, if file is served from
-	                memory.
-	   Return value:
-	     NULL: do not serve file from memory, proceed with normal file open.
-	     non-NULL: pointer to the file contents in memory. data_len must be
-	       initialized with the size of the memory block. */
-	const char *(*open_file)(const struct mg_connection *,
-	                         const char *path,
-	                         size_t *data_len);
-#endif
-
 	/* Called when civetweb is about to serve Lua server page, if
 	   Lua support is enabled.
 	   Parameters: