Jelajahi Sumber

Merge pull request #765 from antmicro/no-filesystems-follow-up

NO_FILESYSTEMS follow-up
bel2125 6 tahun lalu
induk
melakukan
5cdebfd8f9
3 mengubah file dengan 7 tambahan dan 3 penghapusan
  1. 1 0
      docs/Building.md
  2. 3 0
      src/civetweb.c
  3. 3 3
      src/handle_form.inl

+ 1 - 0
docs/Building.md

@@ -149,6 +149,7 @@ make build COPT="-DNDEBUG -DNO_CGI"
 | `DEBUG`                      | build debug version (very noisy)                          |
 | `DEBUG`                      | build debug version (very noisy)                          |
 |                              |                                                           |
 |                              |                                                           |
 | `NO_FILES`                   | do not serve files from a directory                       |
 | `NO_FILES`                   | do not serve files from a directory                       |
+| `NO_FILESYSTEMS`             | comletely disable filesystems usage (requires NO_FILES)   |
 | `NO_SSL`                     | disable SSL functionality                                 |
 | `NO_SSL`                     | disable SSL functionality                                 |
 | `NO_CGI`                     | disable CGI support                                       |
 | `NO_CGI`                     | disable CGI support                                       |
 | `NO_CACHING`                 | disable caching functionality                             |
 | `NO_CACHING`                 | disable caching functionality                             |

+ 3 - 0
src/civetweb.c

@@ -141,6 +141,9 @@ mg_static_assert(sizeof(void *) >= sizeof(int), "data type size check");
 #define ALTERNATIVE_QUEUE
 #define ALTERNATIVE_QUEUE
 #endif
 #endif
 
 
+#if defined(NO_FILESYSTEMS) && !defined(NO_FILES)
+#error "Inconsistent build flags, NO_FILESYSTEMS requires NO_FILES"
+#endif
 
 
 /* DTL -- including winsock2.h works better if lean and mean */
 /* DTL -- including winsock2.h works better if lean and mean */
 #if !defined(WIN32_LEAN_AND_MEAN)
 #if !defined(WIN32_LEAN_AND_MEAN)

+ 3 - 3
src/handle_form.inl

@@ -184,13 +184,13 @@ mg_handle_form_request(struct mg_connection *conn,
 	int64_t file_size = 0; /* init here, to a avoid a false positive
 	int64_t file_size = 0; /* init here, to a avoid a false positive
 	                         "uninitialized variable used" warning */
 	                         "uninitialized variable used" warning */
 
 
+	int has_body_data =
+	    (conn->request_info.content_length > 0) || (conn->is_chunked);
+
 	/* Unused without filesystems */
 	/* Unused without filesystems */
 	(void) fstore;
 	(void) fstore;
 	(void) file_size;
 	(void) file_size;
 
 
-	int has_body_data =
-	    (conn->request_info.content_length > 0) || (conn->is_chunked);
-
 	/* There are three ways to encode data from a HTML form:
 	/* There are three ways to encode data from a HTML form:
 	 * 1) method: GET (default)
 	 * 1) method: GET (default)
 	 *    The form data is in the HTTP query string.
 	 *    The form data is in the HTTP query string.