commit e9710a909c82935ba97bfb393a20be2f9fc58a7b
parent 1f40d87aef938486af354ede8653e2e6d4dbef8f
Author: ukai <ukai>
Date: Wed, 5 Feb 2003 16:18:23 +0000
[w3m-dev 03728] IPv6 hostname
* url.c (parseURL): rewrite IPv6 address parser
From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
Diffstat:
2 files changed, 13 insertions(+), 18 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,3 +1,8 @@
+2003-02-06 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
+
+ * [w3m-dev 03728] IPv6 hostname
+ * url.c (parseURL): rewrite IPv6 address parser
+
2003-02-04 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
* [w3m-dev 03724] Re: view source, edit source
diff --git a/url.c b/url.c
@@ -766,27 +766,17 @@ parseURL(char *url, ParsedURL *p_url, ParsedURL *current)
/* ^p is here */
analyze_url:
q = p;
- while (*p && strchr(":/@?#", *p) == NULL) {
#ifdef INET6
- if (*p == '[') { /* rfc2732 compliance */
- char *p_colon = NULL;
- do {
- p++;
- if ((p_colon == NULL) && (*p == ':'))
- p_colon = p;
- } while (*p && (IS_ALNUM(*p) || *p == ':' || *p == '.'));
- if (*p == ']') {
- p++;
- break;
- }
- else if (p_colon) {
- p = p_colon;
- break;
- }
- }
-#endif
+ if (*q == '[') { /* rfc2732,rfc2373 compliance */
p++;
+ while (IS_XDIGIT(*p) || *p == ':' || *p == '.')
+ p++;
+ if (*p != ']' || (*(p + 1) && strchr(":/?#", *(p + 1)) == NULL))
+ p = q;
}
+#endif
+ while (*p && strchr(":/@?#", *p) == NULL)
+ p++;
switch (*p) {
case ':':
/* scheme://user:pass@host or