[PATCH 1 of 4] Updated request line parsing to allow IPv6 zone identifiers
Maxim Dounin
mdounin at mdounin.ru
Mon Aug 18 23:51:33 UTC 2025
# HG changeset patch
# User Maxim Dounin <mdounin at mdounin.ru>
# Date 1755535190 -10800
# Mon Aug 18 19:39:50 2025 +0300
# Node ID 5cc30c1b91dba2a4358a74093300697ecda9ec39
# Parent 96ce0adabccbb0cad7a0150598b933ddd6026070
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.
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