aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dpi/cookies.c4
-rw-r--r--src/url.c4
-rw-r--r--test/cookies.c8
3 files changed, 8 insertions, 8 deletions
diff --git a/dpi/cookies.c b/dpi/cookies.c
index 93048a5c..f73756f4 100644
--- a/dpi/cookies.c
+++ b/dpi/cookies.c
@@ -920,10 +920,10 @@ static bool_t Cookies_domain_is_ip(const char *domain)
_MSG("an IPv4 address\n");
return TRUE;
}
- if (*domain == '[' &&
+ if (strchr(domain, ':') &&
(len == strspn(domain, "0123456789abcdefABCDEF:.[]"))) {
/* The precise format is shown in section 3.2.2 of rfc 3986 */
- _MSG("an IPv6 address\n");
+ MSG("an IPv6 address\n");
return TRUE;
}
return FALSE;
diff --git a/src/url.c b/src/url.c
index 27c97d1c..7d3880ac 100644
--- a/src/url.c
+++ b/src/url.c
@@ -652,10 +652,10 @@ static bool_t Url_host_is_ip(const char *host)
_MSG("an IPv4 address\n");
return TRUE;
}
- if (*host == '[' &&
+ if (strchr(host, ':') &&
(len == strspn(host, "0123456789abcdefABCDEF:.[]"))) {
/* The precise format is shown in section 3.2.2 of rfc 3986 */
- _MSG("an IPv6 address\n");
+ MSG("an IPv6 address\n");
return TRUE;
}
return FALSE;
diff --git a/test/cookies.c b/test/cookies.c
index af59cb48..1468c248 100644
--- a/test/cookies.c
+++ b/test/cookies.c
@@ -918,13 +918,13 @@ int main()
/* SOME IP ADDRS */
- a_Cookies_set("name=val", "[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]",
+ a_Cookies_set("name=val", "FEDC:BA98:7654:3210:FEDC:BA98:7654:3210",
"/", NULL);
expect(__LINE__, "Cookie: name=val\r\n", "http",
- "[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]", "/");
+ "FEDC:BA98:7654:3210:FEDC:BA98:7654:3210", "/");
- a_Cookies_set("name=val", "[::FFFF:129.144.52.38]", "/", NULL);
- expect(__LINE__, "Cookie: name=val\r\n", "http", "[::FFFF:129.144.52.38]",
+ a_Cookies_set("name=val", "::FFFF:129.144.52.38", "/", NULL);
+ expect(__LINE__, "Cookie: name=val\r\n", "http", "::FFFF:129.144.52.38",
"/");
a_Cookies_set("name=val", "127.0.0.1", "/", NULL);