summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_sockaddr.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2017-06-29 19:25:46 +0300
committerIgor Sysoev <igor@sysoev.ru>2017-06-29 19:25:46 +0300
commit46c6513c2b686d4a6e26c0fe0d0db4280baf5f3e (patch)
tree03b6b6c03bc47584e730b083b22277b1bc61e8bf /src/nxt_sockaddr.c
parent499a8f9ac87765252dc3656c7aac900825475a51 (diff)
downloadunit-46c6513c2b686d4a6e26c0fe0d0db4280baf5f3e.tar.gz
unit-46c6513c2b686d4a6e26c0fe0d0db4280baf5f3e.tar.bz2
Fixed port processing in nxt_sockaddr_text().
Diffstat (limited to 'src/nxt_sockaddr.c')
-rw-r--r--src/nxt_sockaddr.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/nxt_sockaddr.c b/src/nxt_sockaddr.c
index 79d01b8a..f1e0eb77 100644
--- a/src/nxt_sockaddr.c
+++ b/src/nxt_sockaddr.c
@@ -195,6 +195,7 @@ nxt_sockaddr_text(nxt_sockaddr_t *sa)
offset = offsetof(nxt_sockaddr_t, u) + sa->socklen;
sa->start = offset;
+ sa->port_start = offset;
start = nxt_pointer_to(sa, offset);
end = nxt_pointer_to(sa, sa->sockaddr_size);
@@ -210,7 +211,7 @@ nxt_sockaddr_text(nxt_sockaddr_t *sa)
octet[0], octet[1], octet[2], octet[3]);
sa->address_length = p - start;
- sa->port_start = sa->address_length + 1;
+ sa->port_start += sa->address_length + 1;
port = sa->u.sockaddr_in.sin_port;
@@ -227,7 +228,7 @@ nxt_sockaddr_text(nxt_sockaddr_t *sa)
p = nxt_inet6_ntop(sa->u.sockaddr_in6.sin6_addr.s6_addr, p, end);
sa->address_length = p - (start + 1);
- sa->port_start = sa->address_length + 2;
+ sa->port_start += sa->address_length + 3;
*p++ = ']';
@@ -265,7 +266,7 @@ nxt_sockaddr_text(nxt_sockaddr_t *sa)
#endif
sa->address_length = p - start;
- sa->port_start = sa->address_length;
+ sa->port_start += sa->address_length;
sa->length = p - start;
return;