Skip to content

Commit

Permalink
[http] correctly fetch client socket info
Browse files Browse the repository at this point in the history
  • Loading branch information
ionutrazvanionita committed Feb 23, 2017
1 parent a3b37ea commit 331f7a3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions modules/httpd/httpd_proc.c
Expand Up @@ -413,7 +413,7 @@ int answer_to_connection (void *cls, struct MHD_Connection *connection,
int ret_code = MHD_HTTP_OK;
int sv_sockfd;

socklen_t addrlen;
socklen_t addrlen=sizeof(httpd_server_info);
union sockaddr_union* cl_socket;

LM_DBG("START *** cls=%p, connection=%p, url=%s, method=%s, "
Expand All @@ -433,8 +433,10 @@ int answer_to_connection (void *cls, struct MHD_Connection *connection,
pr = NULL;
}

cl_socket = *(union sockaddr_union**)MHD_get_connection_info(connection,
MHD_CONNECTION_INFO_CLIENT_ADDRESS);
/* we're safe here since this returns a struct sockaddr* and
* sockaddr_union contains sockaddr* inside */
cl_socket = (union sockaddr_union *)MHD_get_connection_info(connection,
MHD_CONNECTION_INFO_CLIENT_ADDRESS)->client_addr;

sv_sockfd = MHD_get_connection_info(connection, MHD_CONNECTION_INFO_CONNECTION_FD)->connect_fd;

Expand Down

0 comments on commit 331f7a3

Please sign in to comment.