1
0
mirror of https://github.com/lammertb/libhttp.git synced 2025-12-22 04:02:04 +03:00

Set deprecated remote_ip member as LEGACY_INTERFACE

This commit is contained in:
bel
2015-08-19 19:51:57 +02:00
parent 1c3577891b
commit 17f3949f24
2 changed files with 5 additions and 2 deletions

View File

@@ -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. */

View File

@@ -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