Mauro Tortonesi <[EMAIL PROTECTED]> writes:

> On Mon, 8 Sep 2003, Post, Mark K wrote:
>
>> Absolutely.  I would much rather get an intelligent error message
>> stating that ipv6 addresses are not supported, versus a misleading
>> one about the host not being found.  That would save end-users a
>> whole lot of wasted time.
>
> i agree here.

OK then.  Here is an additional patch:

2003-09-09  Hrvoje Niksic  <[EMAIL PROTECTED]>

        * url.c (url_parse): Return an error if the URL contains a [...]
        IPv6 numeric address and we don't support IPv6.

Index: src/url.c
===================================================================
RCS file: /pack/anoncvs/wget/src/url.c,v
retrieving revision 1.77
diff -u -r1.77 url.c
--- src/url.c   2003/09/05 20:36:17     1.77
+++ src/url.c   2003/09/09 13:02:46
@@ -649,7 +649,9 @@
   "Invalid user name",
 #define PE_UNTERMINATED_IPV6_ADDRESS   5
   "Unterminated IPv6 numeric address",
-#define PE_INVALID_IPV6_ADDRESS                6
+#define PE_IPV6_NOT_SUPPORTED          6
+  "IPv6 addresses not supported",
+#define PE_INVALID_IPV6_ADDRESS                7
   "Invalid IPv6 numeric address"
 };
 
@@ -658,6 +660,7 @@
     *(p) = (v);                                        \
 } while (0)
 
+#ifdef INET6
 /* The following two functions were adapted from glibc. */
 
 static int
@@ -787,8 +790,8 @@
 
   return 1;
 }
+#endif
 
-
 /* Parse a URL.
 
    Return a new struct url if successful, NULL on error.  In case of
@@ -860,6 +863,7 @@
          return NULL;
        }
 
+#ifdef INET6
       /* Check if the IPv6 address is valid. */
       if (!is_valid_ipv6_address(host_b, host_e))
        {
@@ -869,6 +873,10 @@
 
       /* Continue parsing after the closing ']'. */
       p = host_e + 1;
+#else
+      SETERR (error, PE_IPV6_NOT_SUPPORTED);
+      return NULL;
+#endif
     }
   else
     {

Reply via email to