[nginx] Updated request line parsing to allow IPv6 zone identifi...
Maxim Dounin
mdounin at mdounin.ru
Thu Aug 21 23:34:37 UTC 2025
details: http://freenginx.org/hg/nginx/rev/ed87641eff8d
branches:
changeset: 9414:ed87641eff8d
user: Maxim Dounin <mdounin at mdounin.ru>
date: Thu Aug 21 23:49:38 2025 +0300
description:
Updated request line parsing to allow IPv6 zone identifiers.
RFC 6874 defines syntax to allow IPv6 zone identifiers in URIs, by
providing an additional option in IP-literal:
IP-literal = "[" ( IPv6address / IPv6addrz / IPvFuture ) "]"
ZoneID = 1*( unreserved / pct-encoded )
IPv6addrz = IPv6address "%25" ZoneID
The "%" character wasn't previously allowed in IP literals, and therefore
attempts to use such addresses in request line resulted in 400 (Bad Request)
(but was accepted in the Host header field, which uses more relaxed parsing).
With this change, "%" is now allowed in IP literals.
diffstat:
src/http/ngx_http_parse.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diffs (13 lines):
diff --git a/src/http/ngx_http_parse.c b/src/http/ngx_http_parse.c
--- a/src/http/ngx_http_parse.c
+++ b/src/http/ngx_http_parse.c
@@ -466,6 +466,9 @@ ngx_http_parse_request_line(ngx_http_req
case '=':
/* sub-delims */
break;
+ case '%':
+ /* pct-encoded */
+ break;
default:
return NGX_HTTP_PARSE_INVALID_REQUEST;
}
More information about the nginx-devel
mailing list