diff options
author | Roman Arutyunyan <arut@nginx.com> | 2024-11-11 22:28:30 +0400 |
---|---|---|
committer | Roman Arutyunyan <arutyunyan.roman@gmail.com> | 2024-11-26 18:27:07 +0400 |
commit | b2a67d261496555a46b8931935bf822ce9938294 (patch) | |
tree | deb9ed98e31018186a9e1ba3c6641a33758a6e2c /src | |
parent | 3f755b5a9e7145d5ce6b897d2298d5f6c544acf7 (diff) | |
download | nginx-b2a67d261496555a46b8931935bf822ce9938294.tar.gz nginx-b2a67d261496555a46b8931935bf822ce9938294.zip |
Realip: allowed square brackets with portless IPv6 address.
When client address is received, IPv6 address could be specified without
square brackets and without port, as well as both with the brackets and
port. The change allows IPv6 in square brackets and no port, which was
previously considered an error. This format conforms to RFC 3986.
The change also affects proxy_bind and friends.
Diffstat (limited to 'src')
-rw-r--r-- | src/core/ngx_inet.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/core/ngx_inet.c b/src/core/ngx_inet.c index acb2ef48a..2233e617b 100644 --- a/src/core/ngx_inet.c +++ b/src/core/ngx_inet.c @@ -639,7 +639,11 @@ ngx_parse_addr_port(ngx_pool_t *pool, ngx_addr_t *addr, u_char *text, p = ngx_strlchr(text, last, ']'); - if (p == NULL || p == last - 1 || *++p != ':') { + if (p == last - 1) { + return ngx_parse_addr(pool, addr, text + 1, len - 2); + } + + if (p == NULL || *++p != ':') { return NGX_DECLINED; } |