[prev in list] [next in list] [prev in thread] [next in thread] 

List:       privoxy-commits
Subject:    [privoxy-commits] current filters.c,1.117,1.118
From:       noreply () sourceforge ! net
Date:       2009-04-17 11:37:05
Message-ID: E1LumNV-0001Ht-G8 () 23jxhf1 ! ch3 ! sourceforge ! com
[Download RAW message or body]

Update of /cvsroot/ijbswa/current
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv4948

Modified Files:
	filters.c 
Log Message:
Allow IPv6 addresses in forward-override{}.


Index: filters.c
===================================================================
RCS file: /cvsroot/ijbswa/current/filters.c,v
retrieving revision 1.117
retrieving revision 1.118
diff -u -d -r1.117 -r1.118
--- filters.c	17 Apr 2009 11:35:28 -0000	1.117
+++ filters.c	17 Apr 2009 11:37:03 -0000	1.118
@@ -40,6 +40,9 @@
  *
  * Revisions   :
  *    $Log$
+ *    Revision 1.118  2009/04/17 11:37:03  fabiankeil
+ *    Allow IPv6 addresses in forward-override{}.
+ *
  *    Revision 1.117  2009/04/17 11:35:28  fabiankeil
  *    Fix compiler warning.
  *
@@ -2805,12 +2808,24 @@
       if (NULL != socks_proxy)
       {
          /* Parse the SOCKS proxy host[:port] */
+         char *p = socks_proxy;
          fwd->gateway_host = strdup(socks_proxy);
 
-         if (NULL != (socks_proxy = strchr(fwd->gateway_host, ':')))
+         if ((*fwd->gateway_host == '[')
+            && (NULL != (p = strchr(fwd->gateway_host, ']'))))
          {
-            *socks_proxy++ = '\0';
-            fwd->gateway_port = (int)strtol(socks_proxy, NULL, 0);
+            *p++ = '\0';
+            memmove(fwd->gateway_host, fwd->gateway_host + 1,
+               (size_t)(p - fwd->gateway_host));
+            if (*p == ':')
+            {
+               fwd->gateway_port = (int)strtol(++p, NULL, 0);
+            }
+         }
+         else if (NULL != (p = strchr(fwd->gateway_host, ':')))
+         {
+            *p++ = '\0';
+            fwd->gateway_port = (int)strtol(p, NULL, 0);
          }
 
          if (fwd->gateway_port <= 0)
@@ -2832,12 +2847,24 @@
    /* Parse http forwarding settings */
    if (strcmp(http_parent, ".") != 0)
    {
+      char *p = http_parent;
       fwd->forward_host = strdup(http_parent);
 
-      if (NULL != (http_parent = strchr(fwd->forward_host, ':')))
+      if ((*fwd->forward_host == '[')
+         && (NULL != (p = strchr(fwd->forward_host, ']'))))
       {
-         *http_parent++ = '\0';
-         fwd->forward_port = (int)strtol(http_parent, NULL, 0);
+         *p++ = '\0';
+         memmove(fwd->forward_host, fwd->forward_host + 1,
+            (size_t)(p - fwd->forward_host));
+         if (*p == ':')
+         {
+            fwd->forward_port = (int)strtol(++p, NULL, 0);
+         }
+      }
+      else if (NULL != (p = strchr(fwd->forward_host, ':')))
+      {
+         *p++ = '\0';
+         fwd->forward_port = (int)strtol(p, NULL, 0);
       }
 
       if (fwd->forward_port <= 0)


------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
ijbswa-commits mailing list
ijbswa-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ijbswa-commits
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic