diff --git a/include/civetweb.h b/include/civetweb.h index f7b8a2cd..5fab17a0 100644 --- a/include/civetweb.h +++ b/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. */ diff --git a/src/civetweb.c b/src/civetweb.c index 934b44b0..30c0b504 100755 --- a/src/civetweb.c +++ b/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