Revision: 14869
Author:   adrian.chadd
Date:     Sat Jul  9 02:11:28 2011
Log:      This is pretty freaking horrible - it strips out the []'s from the
hostname if they exist. This is because getaddrinfo() doesn't like
square braces around IPv6 addresses.

http://code.google.com/p/lusca-cache/source/detail?r=14869

Modified:
 /playpen/LUSCA_HEAD_ipv6/src/url.c

=======================================
--- /playpen/LUSCA_HEAD_ipv6/src/url.c  Sat Jul  9 01:52:03 2011
+++ /playpen/LUSCA_HEAD_ipv6/src/url.c  Sat Jul  9 02:11:28 2011
@@ -183,6 +183,18 @@
            }
        }
     }
+    /*
+     * If host begins and ends with [], strip them off ;
+     * it's likely an IPv6 address
+     * XXX this is pretty horrible
+     */
+    if (host[0] == '[') {
+        int l = strlen(host);
+        if (l > 1 && host[l-1] == ']') {
+            host[l-1] = '\0';
+            memmove(host, host+1, l-1);
+        }
+    }
     for (t = host; *t; t++)
        *t = xtolower(*t);
     if (stringHasWhitespace(host)) {

--
You received this message because you are subscribed to the Google Groups 
"lusca-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/lusca-commit?hl=en.

Reply via email to