Author: rpluem
Date: Tue Aug 26 18:54:01 2025
New Revision: 1928028
Log:
* Only apply percent decoding/encoding for link-local addresses under prefix fe80::/10
Modified:
apr/apr/trunk/test/testuri.c
apr/apr/trunk/uri/apr_uri.c
Modified: apr/apr/trunk/test/testuri.c
==============================================================================
--- apr/apr/trunk/test/testuri.c Tue Aug 26 18:26:36 2025 (r1928027)
+++ apr/apr/trunk/test/testuri.c Tue Aug 26 18:54:01 2025 (r1928028)
@@ -97,6 +97,11 @@ struct aup_test aup_tests[] =
0, "http", "[fe80::1%25iface]", NULL, NULL, "fe80::1%iface", NULL, "/", NULL, NULL, 0
},
{
+ /* https://datatracker.ietf.org/doc/html/rfc6874 */
+ "http://[ffff::1%25iface]/",
+ 0, "http", "[ffff::1%25iface]", NULL, NULL, "ffff::1%25iface", NULL, "/", NULL, NULL, 0
+ },
+ {
"http://localhost",
0, "http", "localhost", NULL, NULL, "localhost", NULL, NULL, NULL, NULL, 0
},
@@ -214,6 +219,11 @@ struct uph_test uph_tests[] =
0, "fe80::1%iface", "443", 443
},
{
+ /* https://datatracker.ietf.org/doc/html/rfc6874 */
+ "[ffff::1%25iface]:443",
+ 0, "ffff::1%25iface", "443", 443
+ },
+ {
"127.0.0.1:443",
0, "127.0.0.1", "443", 443
},
Modified: apr/apr/trunk/uri/apr_uri.c
==============================================================================
--- apr/apr/trunk/uri/apr_uri.c Tue Aug 26 18:26:36 2025 (r1928027)
+++ apr/apr/trunk/uri/apr_uri.c Tue Aug 26 18:54:01 2025 (r1928028)
@@ -80,9 +80,19 @@ static apr_status_t detect_scope_zone_id
*have_zone_id = 0;
- if (len < 3) {
- /* Need *at least* the three characters for a percent-encoded percent
- * sign.
+ if (len < 3 + 5) {
+ /*
+ * We neeed *at least* the three characters for a percent-encoded
+ * percent sign. Furthermore scope id's are only allowed for link-local
+ * addresses under prefix fe80::/10.
+ */
+ return APR_SUCCESS;
+ }
+
+ if (strncasecmp(ipv6addr, "fe80:", 5)) {
+ /*
+ * Scope id's are only allowed for link-local addresses under prefix
+ * fe80::/10.
*/
return APR_SUCCESS;
}
@@ -134,7 +144,11 @@ static char *percent_encode_scope_zone_i
size_t offset;
char *hostcopy;
- if (s == NULL) {
+ if ((s == NULL) || strncasecmp(uptr->hostname, "fe80:", 5)) {
+ /*
+ * Scope id's are only allowed for link-local addresses under prefix
+ * fe80::/10.
+ */
return uptr->hostname;
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.