--------------------- PatchSet 1378 Date: 2005/05/15 14:48:29 Author: rmartinez Branch: squid3-ipv6 Tag: (none) Log: Added brackets for IPv6 URL's. Module ready unless error Members: src/cache_cf.cc:1.40.2.5->1.40.2.6 Index: squid3/src/cache_cf.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/cache_cf.cc,v retrieving revision 1.40.2.5 retrieving revision 1.40.2.6 diff -u -r1.40.2.5 -r1.40.2.6 --- squid3/src/cache_cf.cc 5 May 2005 09:37:37 -0000 1.40.2.5 +++ squid3/src/cache_cf.cc 15 May 2005 14:48:29 -0000 1.40.2.6 @@ -1,6 +1,6 @@ /* - * $Id: cache_cf.cc,v 1.40.2.5 2005/05/05 09:37:37 rmartinez Exp $ + * $Id: cache_cf.cc,v 1.40.2.6 2005/05/15 14:48:29 rmartinez Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -2595,6 +2595,13 @@ host = NULL; port = 0; +#ifdef INET6 +#error "FIXME when CURRENTLY_UNUSED becomes 1" + // Post: If you're not given the port, fail. + if (sscanf(token, "%d", &port) ) + if (sscanf(token, "%[^:]:%d", host, &port) < 2) + self_destruct(); +#endif if ((t = strchr(token, ':'))) { /* host:port */ host = token; @@ -2613,11 +2620,11 @@ PORT_FROM_SA(s->s) = htons(port); if (NULL == host) - s->s.sin_addr = any_addr; - else if (1 == safe_inet_addr(host, &s->s.sin_addr)) + ADDR_FROM_SA(s->s) = any_addr; + else if (1 == SAFE_INET_ADDR(host, &ADDR_FROM_SA(s->s))) (void) 0; - else if ((hp = gethostbyname(host))) /* dont use ipcache */ - s->s.sin_addr = inaddrFromHostent(hp); + else if ((hp = GETHOSTBYNAME(host))) /* dont use ipcache */ + ADDR_FROM_SA(s->s) = inaddrFromHostent(hp); else self_destruct(); @@ -2641,10 +2648,12 @@ dump_sockaddr_in_list(StoreEntry * e, const char *n, const sockaddr_in_list * s) { while (s) { - storeAppendPrintf(e, "%s %s:%d\n", + storeAppendPrintf(e, "%s %s%s%s:%d\n", n, - INET_NTOA(s->s.sin_addr), - ntohs(s->s.sin_port)); + (AF_FAMILY==AF_INET6) ? "[" : null_string , + SA_NTOA(s->s), + (AF_FAMILY==AF_INET6) ? "]" : null_string , + ntohs(PORT_FROM_SA(s->s)); s = s->next; } } @@ -2806,13 +2815,11 @@ static void dump_generic_http_port(StoreEntry * e, const char *n, const http_port_list * s) { -#ifdef INET6 - storeAppendPrintf(e, "%s [%s]:%d", -#else - storeAppendPrintf(e, "%s %s:%d", -#endif + storeAppendPrintf(e, "%s %s%s%s:%d", n, - INET_NTOA(ADDR_FROM_SA(s->s)), + (AF_FAMILY==AF_INET6) ? "[" : null_string, + SA_NTOA(s->s), + (AF_FAMILY==AF_INET6) ? "]" : null_string, ntohs(PORT_FROM_SA(s->s))); if (s->defaultsite)