File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -70,6 +70,12 @@ static schemes_t schemes[] =
7070 { NULL , 0xFFFF } /* unknown port */
7171};
7272
73+ #define LINK_LOCAL (ipv6addr ) ((strlen(ipv6addr) >= 5) && \
74+ ((ipv6addr)[4] == ':') && \
75+ !strncasecmp(ipv6addr, "fe", 2) && \
76+ strchr("89aAbB", (ipv6addr)[2]) && \
77+ strchr("0123456789aAbBcCdDeEfF", (ipv6addr)[3]))
78+
7379/*
7480 * *only* for IPv6 addresses with a zone identifier according to RFC6874
7581 */
@@ -89,7 +95,7 @@ static apr_status_t detect_scope_zone_id(int *have_zone_id, char const *ipv6addr
8995 return APR_SUCCESS ;
9096 }
9197
92- if (strncasecmp (ipv6addr , "fe80:" , 5 )) {
98+ if (! LINK_LOCAL (ipv6addr )) {
9399 /*
94100 * Scope id's are only allowed for link-local addresses under prefix
95101 * fe80::/10.
@@ -144,7 +150,7 @@ static char *percent_encode_scope_zone_id(apr_pool_t *p, apr_uri_t const *uptr)
144150 size_t offset ;
145151 char * hostcopy ;
146152
147- if ((s == NULL ) || strncasecmp (uptr -> hostname , "fe80:" , 5 )) {
153+ if ((s == NULL ) || ! LINK_LOCAL (uptr -> hostname )) {
148154 /*
149155 * Scope id's are only allowed for link-local addresses under prefix
150156 * fe80::/10.
You can’t perform that action at this time.
0 commit comments