Преглед изворни кода

Set deprecated remote_ip member as LEGACY_INTERFACE

bel пре 10 година
родитељ
комит
17f3949f24
2 измењених фајлова са 5 додато и 2 уклоњено
  1. 3 0
      include/civetweb.h
  2. 2 2
      src/civetweb.c

+ 3 - 0
include/civetweb.h

@@ -61,8 +61,11 @@ struct mg_request_info {
 	const char *remote_user;    /* Authenticated user, or NULL if no auth
 	                               used */
 	char remote_addr[48];       /* Client's IP address as a string. */
+
+#if defined(MG_LEGACY_INTERFACE)
 	long remote_ip; /* Client's IP address. Deprecated: use remote_addr instead
 	                   */
+#endif
 
 	long long content_length; /* Length (in bytes) of the request body,
 	                             can be -1 if no length was given. */

+ 2 - 2
src/civetweb.c

@@ -10251,10 +10251,10 @@ static void *worker_thread_run(void *thread_func_param)
 			sockaddr_to_string(conn->request_info.remote_addr,
 			                   sizeof(conn->request_info.remote_addr),
 			                   &conn->client.rsa);
-			/* TODO: #if defined(MG_LEGACY_INTERFACE) */
+#if defined(MG_LEGACY_INTERFACE)
 			addr = ntohl(conn->client.rsa.sin.sin_addr.s_addr);
 			memcpy(&conn->request_info.remote_ip, &addr, 4);
-			/* #endif */
+#endif
 			conn->request_info.is_ssl = conn->client.is_ssl;
 
 			if (!conn->client.is_ssl