How can i get ip and port under forward proxy
mdounin at mdounin.ru
Fri Jun 7 02:04:42 UTC 2013
On Thu, Jun 06, 2013 at 09:29:36PM -0400, honwel wrote:
> Thanks, i add a line " len = NGX_SOCKADDRLEN ", then , it is ok! thanks
> very much.
> but i want to know , why? (struct sockaddr *) &sa and &len as are input
> paramter, why len need initialized?
As I already said, len value is used as an input parameter by
getsockname() function, and hence it must be initialized properly.
See here for more details:
: The address_len argument points to a socklen_t object which on
: input specifies the length of the supplied sockaddr structure, and
: on output specifies the length of the stored address. If the
: actual length of the address is greater than the length of the
: supplied sockaddr structure, the stored address shall be
More information about the nginx