How can i get ip and port under forward proxy

Maxim Dounin mdounin at mdounin.ru
Thu Jun 6 13:03:10 UTC 2013


Hello!

On Wed, Jun 05, 2013 at 09:10:10PM -0400, honwel wrote:

> Ok,  code is as follow:

[...]

>     ngx_peer_connection_t *pc;
>     u_char            sa[NGX_SOCKADDRLEN];
>     socklen_t         len;
>     u_char            text[NGX_SOCKADDR_STRLEN];
>     u_char            *p;
>     struct sockaddr_in *sin;

[...]

>     if (pc->local_socket) {
>         if (getsockname(pc->local_socket, (struct sockaddr *) &sa, &len) !=
> -1) {

At this point, len is uninitialized.  It is used by getsockname() 
as an input paramter though, and specifies the length of 
supplied sockaddr structure.

-- 
Maxim Dounin
http://nginx.org/en/donation.html



More information about the nginx mailing list