Quellcode durchsuchen

Fix some TODOs and auto-format code

bel vor 9 Jahren
Ursprung
Commit
0c7c7ed678
3 geänderte Dateien mit 12 neuen und 11 gelöschten Zeilen
  1. 8 4
      src/civetweb.c
  2. 1 0
      src/mod_duktape.inl
  3. 3 7
      test/public_server.c

+ 8 - 4
src/civetweb.c

@@ -6485,8 +6485,8 @@ static void prepare_cgi_environment(struct mg_connection *conn,
 	addenv(env, "REQUEST_METHOD=%s", conn->request_info.request_method);
 	addenv(env, "REMOTE_PORT=%d", conn->request_info.remote_port);
 
-	/* TODO: Check if request_uri or local_uri should be used */
 	addenv(env, "REQUEST_URI=%s", conn->request_info.request_uri);
+	addenv(env, "LOCAL_URI=%s", conn->request_info.local_uri);
 
 	/* SCRIPT_NAME */
 	addenv(env,
@@ -11297,6 +11297,13 @@ static void free_context(struct mg_context *ctx)
 
 	/* Deallocate the tls variable */
 	if (mg_atomic_dec(&sTlsInit) == 0) {
+#if defined(_WIN32) && !defined(__SYMBIAN32__)
+		DeleteCriticalSection(&global_log_file_lock);
+#endif /* _WIN32 && !__SYMBIAN32__ */
+#if !defined(_WIN32)
+		pthread_mutexattr_destroy(&pthread_mutex_attr);
+#endif
+
 		pthread_key_delete(sTlsKey);
 	}
 
@@ -11406,9 +11413,6 @@ struct mg_context *mg_start(const struct mg_callbacks *callbacks,
 	if (mg_atomic_inc(&sTlsInit) == 1) {
 
 #if defined(_WIN32) && !defined(__SYMBIAN32__)
-#if defined(_MSC_VER)
-#pragma warning(suppress : 28125)
-#endif
 		InitializeCriticalSection(&global_log_file_lock);
 #endif /* _WIN32 && !__SYMBIAN32__ */
 #if !defined(_WIN32)

+ 1 - 0
src/mod_duktape.inl

@@ -16,6 +16,7 @@
 /* TODO: use upvalues (or whatever equivalent) */
 static struct mg_connection *xxx_conn = NULL;
 
+
 static duk_ret_t duk_itf_send(duk_context *ctx)
 {
 	duk_size_t len = 0;

+ 3 - 7
test/public_server.c

@@ -357,13 +357,6 @@ static int websock_server_connect(const struct mg_connection *conn, void *udata)
 }
 
 
-#ifndef _WIN32
-/* TODO(critical): Why is mg_lock_connection here a deadlock in Linux,
- * while it is OK for Windows? */
-#define mg_lock_connection(conn)
-#define mg_unlock_connection(conn)
-#endif
-
 static void websock_server_ready(struct mg_connection *conn, void *udata)
 {
 	ck_assert_ptr_eq((void *)udata, (void *)7531);
@@ -423,6 +416,7 @@ static void websock_server_close(const struct mg_connection *conn, void *udata)
 	 * closed */
 }
 
+
 /****************************************************************************/
 /* WEBSOCKET CLIENT                                                         */
 /****************************************************************************/
@@ -432,6 +426,7 @@ struct tclient_data {
 	int closed;
 };
 
+
 static int websocket_client_data_handler(struct mg_connection *conn,
                                          int flags,
                                          char *data,
@@ -459,6 +454,7 @@ static int websocket_client_data_handler(struct mg_connection *conn,
 	return 1;
 }
 
+
 static void websocket_client_close_handler(const struct mg_connection *conn,
                                            void *user_data)
 {