From 84fefac4a42e24fbd214a159870239ca0060382b Mon Sep 17 00:00:00 2001 From: Fumitoshi UKAI Date: Wed, 5 Feb 2003 16:18:23 +0000 Subject: [w3m-dev 03728] IPv6 hostname * url.c (parseURL): rewrite IPv6 address parser From: Hironori SAKAMOTO --- url.c | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) (limited to 'url.c') diff --git a/url.c b/url.c index 5ba157d..45b4a58 100644 --- a/url.c +++ b/url.c @@ -1,4 +1,4 @@ -/* $Id: url.c,v 1.72 2003/01/31 16:25:10 ukai Exp $ */ +/* $Id: url.c,v 1.73 2003/02/05 16:18:23 ukai Exp $ */ #include "fm.h" #include #include @@ -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 -- cgit v1.2.3