Plug memory leak if listen-address only specifies the port.
[privoxy.git] / debian / patches / 03_ipv6.dpatch
index 7508be9..08f6996 100755 (executable)
@@ -7,6 +7,9 @@
 ## DP: adapted to the 3.0 branch of privoxy by Roland Rosenfeld
 ## DP: adapted to 3.0.4 by higuita, but i'm no programmer, so i hope i 
 ## DP: didnt broke anything :)
+## DP: adapted to 3.0.6 by Petr Písa?? petrp@users.sf.net found on
+## DP: http://xpisar.wz.cz/privoxy-ipv6/ Use privoxy-3.0.6-stable-ipv6.diff.bz2
+## DP: and stripped
 
 @DPATCH@
 diff -urNad privoxy~/GNUmakefile.in privoxy/GNUmakefile.in
@@ -305,7 +308,7 @@ diff -urNad privoxy~/cgi.c privoxy/cgi.c
   *                Based on the Internet Junkbuster originally written
   *                by and Copyright (C) 1997 Anonymous Coders and 
   *                Junkbusters Corporation.  http://www.junkbusters.com
-@@ -2250,7 +2253,6 @@
+@@ -2259,7 +2262,6 @@
   *********************************************************************/
  struct map *default_exports(const struct client_state *csp, const char *caller)
  {
@@ -313,20 +316,20 @@ diff -urNad privoxy~/cgi.c privoxy/cgi.c
     jb_err err;
     struct map * exports;
     int local_help_exists = 0;
-@@ -2286,8 +2288,7 @@
+@@ -2295,8 +2297,7 @@
     if (!err) err = map_block_killer(exports, "can-toggle");
  #endif
  
 -   snprintf(buf, 20, "%d", csp->config->hport);
 -   if (!err) err = map(exports, "my-port", 1, buf, 1);
-+      if (!err) err = map(exports, "my-port", 1, csp->my_port_str, 1);
++   if (!err) err = map(exports, "my-port", 1, csp->my_port_str, 1);
  
     if(!strcmp(CODE_STATUS, "stable"))
     {
 diff -urNad privoxy~/errlog.c privoxy/errlog.c
 --- privoxy~/errlog.c
 +++ privoxy/errlog.c
-@@ -739,6 +739,13 @@
+@@ -746,6 +746,13 @@
              break;
           case 'E':
              /* Non-standard: Print error code from errno */
@@ -353,7 +356,7 @@ diff -urNad privoxy~/filters.c privoxy/filters.c
   *                Based on the Internet Junkbuster originally written
   *                by and Copyright (C) 1997 Anonymous Coders and
   *                Junkbusters Corporation.  http://www.junkbusters.com
-@@ -468,6 +471,9 @@
+@@ -471,6 +474,9 @@
  #include <ctype.h>
  #include <string.h>
  #include <assert.h>
@@ -363,7 +366,7 @@ diff -urNad privoxy~/filters.c privoxy/filters.c
  
  #ifndef _WIN32
  #ifndef __OS2__
-@@ -502,17 +508,119 @@
+@@ -505,17 +511,119 @@
  
  const char filters_h_rcs[] = FILTERS_H_VERSION;
  
@@ -492,7 +495,7 @@ diff -urNad privoxy~/filters.c privoxy/filters.c
  /*********************************************************************
   *
   * Function    :  block_acl
-@@ -542,7 +650,7 @@
+@@ -545,7 +653,7 @@
     /* search the list */
     while (acl != NULL)
     {
@@ -501,7 +504,7 @@ diff -urNad privoxy~/filters.c privoxy/filters.c
        {
           if (dst == NULL)
           {
-@@ -552,8 +660,8 @@
+@@ -555,8 +663,8 @@
                 return(0);
              }
           }
@@ -512,7 +515,7 @@ diff -urNad privoxy~/filters.c privoxy/filters.c
           {
              if (acl->action == ACL_PERMIT)
              {
-@@ -572,81 +680,249 @@
+@@ -575,81 +683,249 @@
  
  }
  
@@ -1336,7 +1339,7 @@ diff -urNad privoxy~/jbsockets.c privoxy/jbsockets.c
   *                Based on the Internet Junkbuster originally written
   *                by and Copyright (C) 1997 Anonymous Coders and 
   *                Junkbusters Corporation.  http://www.junkbusters.com
-@@ -275,6 +279,7 @@
+@@ -285,6 +289,7 @@
  #include "jbsockets.h"
  #include "filters.h"
  #include "errlog.h"
@@ -1344,7 +1347,7 @@ diff -urNad privoxy~/jbsockets.c privoxy/jbsockets.c
  
  const char jbsockets_h_rcs[] = JBSOCKETS_H_VERSION;
  
-@@ -287,141 +292,194 @@
+@@ -297,141 +302,194 @@
   *                that this is allowed according to ACL.
   *
   * Parameters  :
@@ -1626,7 +1629,7 @@ diff -urNad privoxy~/jbsockets.c privoxy/jbsockets.c
  }
  
  
-@@ -561,55 +619,30 @@
+@@ -571,55 +629,30 @@
  
  /*********************************************************************
   *
@@ -1691,7 +1694,7 @@ diff -urNad privoxy~/jbsockets.c privoxy/jbsockets.c
  
  #ifdef _WIN32
     if (fd == JB_INVALID_SOCKET)
-@@ -635,8 +668,17 @@
+@@ -645,8 +678,17 @@
      */
     setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *)&one, sizeof(one));
  #endif /* ndef _WIN32 */
@@ -1711,7 +1714,7 @@ diff -urNad privoxy~/jbsockets.c privoxy/jbsockets.c
     {
  #ifdef _WIN32
        errno = WSAGetLastError();
-@@ -655,7 +697,7 @@
+@@ -665,7 +707,7 @@
        }
     }
  
@@ -1720,7 +1723,7 @@ diff -urNad privoxy~/jbsockets.c privoxy/jbsockets.c
     {
        if (errno != EINTR)
        {
-@@ -663,7 +705,11 @@
+@@ -673,7 +715,11 @@
        }
     }
  
@@ -1733,7 +1736,7 @@ diff -urNad privoxy~/jbsockets.c privoxy/jbsockets.c
     return 0;
  
  }
-@@ -671,6 +717,91 @@
+@@ -681,6 +727,91 @@
  
  /*********************************************************************
   *
@@ -1802,12 +1805,12 @@ diff -urNad privoxy~/jbsockets.c privoxy/jbsockets.c
 +                      "There may be another Privoxy or some other "
 +                      "proxy running on port %s",
 +                      log_host, port, numeric_hostname, numeric_port, numeric_port);
-+                              break;
++            break;
 +         case -2 :
 +            log_error(LOG_LEVEL_ERROR, "can't bind to %s:%s (%s:%s): "
 +                      "Out of memory",
 +                      log_host, port, numeric_hostname, numeric_port);
-+                              break;
++            break;
 +         default :
 +            log_error(LOG_LEVEL_ERROR, "can't bind to %s:%s: because %E",
 +                      log_host, numeric_port);
@@ -1825,7 +1828,7 @@ diff -urNad privoxy~/jbsockets.c privoxy/jbsockets.c
   * Function    :  accept_connection
   *
   * Description :  Accepts a connection on a socket.  Socket must have
-@@ -687,8 +818,7 @@
+@@ -697,8 +828,7 @@
   *********************************************************************/
  int accept_connection(struct client_state * csp, jb_socket fd)
  {
@@ -1835,7 +1838,7 @@ diff -urNad privoxy~/jbsockets.c privoxy/jbsockets.c
     jb_socket afd;
  #if defined(_WIN32) || defined(__OS2__) || defined(__APPLE_CC__) || defined(AMIGA)
     /* Wierdness - fix a warning. */
-@@ -696,15 +826,7 @@
+@@ -706,15 +836,7 @@
  #else
     socklen_t c_length, s_length;
  #endif
@@ -1852,7 +1855,7 @@ diff -urNad privoxy~/jbsockets.c privoxy/jbsockets.c
  
     c_length = s_length = sizeof(client);
  
-@@ -724,6 +846,12 @@
+@@ -734,6 +856,12 @@
        return 0;
     }
  #endif
@@ -1865,7 +1868,7 @@ diff -urNad privoxy~/jbsockets.c privoxy/jbsockets.c
  
     /* 
      * Determine the IP-Adress that the client used to reach us
-@@ -731,49 +859,50 @@
+@@ -741,49 +869,50 @@
      */
     if (!getsockname(afd, (struct sockaddr *) &server, &s_length))
     {
@@ -1904,7 +1907,7 @@ diff -urNad privoxy~/jbsockets.c privoxy/jbsockets.c
 +         log_error(LOG_LEVEL_ERROR, "accept: Could not get my own hostname because %E");
 +         strncpy(hostname,"unknown host",NI_MAXHOST);
        }
--#elif defined(OSX_DARWIN) || defined(__OpenBSD__)
+-#elif FEATURE_PTHREAD
 -      pthread_mutex_lock(&gethostbyaddr_mutex);
 -      host = gethostbyaddr((const char *)&server.sin_addr, 
 -                           sizeof(server.sin_addr), AF_INET);
@@ -1950,7 +1953,7 @@ diff -urNad privoxy~/jbsockets.c privoxy/jbsockets.c
  
     return 1;
  
-@@ -784,108 +913,42 @@
+@@ -794,108 +923,48 @@
   *
   * Function    :  resolve_hostname_to_ip
   *
@@ -1972,7 +1975,15 @@ diff -urNad privoxy~/jbsockets.c privoxy/jbsockets.c
 -{
 -   struct sockaddr_in inaddr;
 -   struct hostent *hostp;
--   unsigned int dns_retries = 0;
++addr_list *resolve_hostname_to_ip(const char *host, const char *port, int pf)
++ {
++   /* TODO 
++    * Do all supported platforms have "getaddrinfo"?
++    */
++    
++   struct addrinfo hints, *res0;
++   int result;
+    unsigned int dns_retries = 0;
 -#if defined(HAVE_GETHOSTBYNAME_R_6_ARGS) || defined(HAVE_GETHOSTBYNAME_R_5_ARGS) || defined(HAVE_GETHOSTBYNAME_R_3_ARGS)
 -   struct hostent result;
 -#if defined(HAVE_GETHOSTBYNAME_R_6_ARGS) || defined(HAVE_GETHOSTBYNAME_R_5_ARGS)
@@ -1982,7 +1993,7 @@ diff -urNad privoxy~/jbsockets.c privoxy/jbsockets.c
 -   struct hostent_data hdata;
 -#endif /* def HAVE_GETHOSTBYNAME_R_(6|5)_ARGS */
 -#endif /* def HAVE_GETHOSTBYNAME_R_(6|5|3)_ARGS */
--
 -   if ((host == NULL) || (*host == '\0'))
 -   {
 -      return(INADDR_ANY);
@@ -2012,7 +2023,7 @@ diff -urNad privoxy~/jbsockets.c privoxy/jbsockets.c
 -      {
 -         hostp = NULL;
 -      }
--#elif defined(OSX_DARWIN) || defined(__OpenBSD__)
+-#elif FEATURE_PTHREAD
 -      pthread_mutex_lock(&gethostbyname_mutex);
 -      while ( NULL == (hostp = gethostbyname(host))
 -            && (h_errno == TRY_AGAIN) && (dns_retries++ < 10) )
@@ -2056,24 +2067,19 @@ diff -urNad privoxy~/jbsockets.c privoxy/jbsockets.c
 -         (char *) hostp->h_addr,
 -         sizeof(inaddr.sin_addr)
 -      );
--   }
--   return(inaddr.sin_addr.s_addr);
--
--}
--
-+addr_list *resolve_hostname_to_ip(const char *host, const char *port, int pf)
-+ {
-+   /* TODO 
-+    * Do all supported platforms have "getaddrinfo"?
-+    */
-+    
-+   struct addrinfo hints, *res0;
-+   int result;
 +   memset(&hints, 0, sizeof(hints));
 +   hints.ai_family = pf;
 +   hints.ai_socktype = SOCK_STREAM;
 +  
-+   result = getaddrinfo(host, port, &hints, &res0);
++   while ((result = getaddrinfo(host, port, &hints, &res0)) 
++          && (result == EAI_AGAIN) && (dns_retries++ < 10)) {
++      log_error(LOG_LEVEL_ERROR, "Timeout #%u while trying to resolve %s. Trying again.",
++                dns_retries, host);
+    }
+-   return(inaddr.sin_addr.s_addr);
+-
+-}
+-
 +   if ( result != 0 )
 +     {
 +      log_error(LOG_LEVEL_ERROR, "could not resolve hostname %s because %s", host,gai_strerror(result));
@@ -2132,7 +2138,7 @@ diff -urNad privoxy~/jbsockets.h privoxy/jbsockets.h
 diff -urNad privoxy~/jcc.c privoxy/jcc.c
 --- privoxy~/jcc.c
 +++ privoxy/jcc.c
-@@ -747,6 +747,7 @@
+@@ -767,6 +767,7 @@
  #include "cgi.h"
  #include "loadcfg.h"
  #include "urlmatch.h"
@@ -2140,7 +2146,7 @@ diff -urNad privoxy~/jcc.c privoxy/jcc.c
  
  const char jcc_h_rcs[] = JCC_H_VERSION;
  const char project_h_rcs[] = PROJECT_H_VERSION;
-@@ -2306,61 +2307,78 @@
+@@ -2338,61 +2339,78 @@
   * Returns     :  Port that was opened.
   *
   *********************************************************************/
@@ -2221,7 +2227,7 @@ diff -urNad privoxy~/jcc.c privoxy/jcc.c
 +               "proxy running on port %s",
 +               (NULL != bs->haddr) ? bs->haddr : "INADDR_ANY",
 +                      bs->hport, bs->hport);
-+                              break;
++            break;
  
           case -2 :
 -            log_error(LOG_LEVEL_FATAL, "can't bind to %s:%d: " 
@@ -2229,7 +2235,7 @@ diff -urNad privoxy~/jcc.c privoxy/jcc.c
                 "The hostname is not resolvable",
 -               (NULL != config->haddr) ? config->haddr : "INADDR_ANY", config->hport);
 +               (NULL != bs->haddr) ? bs->haddr : "INADDR_ANY", bs->hport);
-+                              break;
++            break;
  
           default :
 -            log_error(LOG_LEVEL_FATAL, "can't bind to %s:%d: because %E",
@@ -2255,7 +2261,7 @@ diff -urNad privoxy~/jcc.c privoxy/jcc.c
  }
  
  
-@@ -2389,12 +2407,18 @@
+@@ -2421,12 +2439,18 @@
  static void listen_loop(void)
  {
     struct client_state *csp = NULL;
@@ -2276,7 +2282,7 @@ diff -urNad privoxy~/jcc.c privoxy/jcc.c
  
  #ifdef FEATURE_GRACEFUL_TERMINATION
     while (!g_terminate)
-@@ -2468,14 +2492,55 @@
+@@ -2500,14 +2524,55 @@
            * that this will hurt people's feelings.
            */
  
@@ -2335,7 +2341,7 @@ diff -urNad privoxy~/jcc.c privoxy/jcc.c
        {
           log_error(LOG_LEVEL_CONNECT, "accept failed: %E");
  
-@@ -2493,6 +2558,8 @@
+@@ -2525,6 +2590,8 @@
           log_error(LOG_LEVEL_CONNECT, "OK");
        }
  
@@ -2357,7 +2363,7 @@ diff -urNad privoxy~/loadcfg.c privoxy/loadcfg.c
   *                Based on the Internet Junkbuster originally written
   *                by and Copyright (C) 1997 Anonymous Coders and
   *                Junkbusters Corporation.  http://www.junkbusters.com
-@@ -402,6 +405,7 @@
+@@ -408,6 +411,7 @@
  #include "encode.h"
  #include "urlmatch.h"
  #include "cgi.h"
@@ -2365,7 +2371,7 @@ diff -urNad privoxy~/loadcfg.c privoxy/loadcfg.c
  
  const char loadcfg_h_rcs[] = LOADCFG_H_VERSION;
  
-@@ -521,8 +525,8 @@
+@@ -527,8 +531,8 @@
        struct forward_spec * next_fwd = cur_fwd->next;
        free_url_spec(cur_fwd->url);
  
@@ -2376,7 +2382,7 @@ diff -urNad privoxy~/loadcfg.c privoxy/loadcfg.c
        free(cur_fwd);
        cur_fwd = next_fwd;
     }
-@@ -539,7 +543,16 @@
+@@ -545,7 +549,16 @@
     freez(config->confdir);
     freez(config->logdir);
  
@@ -2394,7 +2400,7 @@ diff -urNad privoxy~/loadcfg.c privoxy/loadcfg.c
     freez(config->logfile);
  
     for (i = 0; i < MAX_AF_FILES; i++)
-@@ -606,6 +619,28 @@
+@@ -612,6 +625,28 @@
   * Returns     :  The configuration_spec, or NULL on error.
   *
   *********************************************************************/
@@ -2423,7 +2429,7 @@ diff -urNad privoxy~/loadcfg.c privoxy/loadcfg.c
  struct configuration_spec * load_config(void)
  {
     char buf[BUFFER_SIZE];
-@@ -637,12 +672,7 @@
+@@ -643,12 +678,7 @@
     fs->f = config = (struct configuration_spec *)zalloc(sizeof(*config));
  
     if (config==NULL)
@@ -2437,7 +2443,7 @@ diff -urNad privoxy~/loadcfg.c privoxy/loadcfg.c
  
     /*
      * This is backwards from how it's usually done.
-@@ -659,7 +689,7 @@
+@@ -665,7 +695,7 @@
      * Set to defaults
      */
     config->multi_threaded            = 1;
@@ -2446,7 +2452,7 @@ diff -urNad privoxy~/loadcfg.c privoxy/loadcfg.c
     config->buffer_limit              = 4096 * 1024;
     config->usermanual                = strdup(USER_MANUAL_URL);
     config->proxy_args                = strdup("");
-@@ -678,9 +708,6 @@
+@@ -684,9 +714,6 @@
        char cmd[BUFFER_SIZE];
        char arg[BUFFER_SIZE];
        char tmp[BUFFER_SIZE];
@@ -2456,7 +2462,7 @@ diff -urNad privoxy~/loadcfg.c privoxy/loadcfg.c
        struct forward_spec *cur_fwd;
        int vec_count;
        char *vec[3];
-@@ -791,74 +818,23 @@
+@@ -797,74 +824,23 @@
   * *************************************************************************/
  #ifdef FEATURE_ACL
           case hash_deny_access:
@@ -2511,10 +2517,10 @@ diff -urNad privoxy~/loadcfg.c privoxy/loadcfg.c
 -                     vec[0]);
 +               case 1:
 +                  config->acl = add_to_acl_list(config->acl, ACL_DENY, vec[0], NULL, &config->proxy_args);
-+                                              break;
++                  break;
 +               case 2:
 +                  config->acl = add_to_acl_list(config->acl, ACL_DENY, vec[0], vec[1], &config->proxy_args);
-+                                              break;
++                  break;
 +               default:
 +                  log_error(LOG_LEVEL_ERROR, "Wrong number of parameters for "
 +                            "deny-access directive in configuration file.");
@@ -2544,7 +2550,7 @@ diff -urNad privoxy~/loadcfg.c privoxy/loadcfg.c
  #endif /* def FEATURE_ACL */
  
  /* *************************************************************************
-@@ -978,16 +954,18 @@
+@@ -984,16 +960,18 @@
  
              if (strcmp(p, ".") != 0)
              {
@@ -2569,7 +2575,7 @@ diff -urNad privoxy~/loadcfg.c privoxy/loadcfg.c
                    cur_fwd->forward_port = 8000;
                 }
              }
-@@ -1041,15 +1019,27 @@
+@@ -1047,15 +1025,27 @@
  
              if (strcmp(p, ".") != 0)
              {
@@ -2601,7 +2607,7 @@ diff -urNad privoxy~/loadcfg.c privoxy/loadcfg.c
                    cur_fwd->gateway_port = 1080;
                 }
              }
-@@ -1059,16 +1049,26 @@
+@@ -1065,16 +1055,26 @@
  
              if (strcmp(p, ".") != 0)
              {
@@ -2632,7 +2638,7 @@ diff -urNad privoxy~/loadcfg.c privoxy/loadcfg.c
                    cur_fwd->forward_port = 8000;
                 }
              }
-@@ -1120,16 +1120,30 @@
+@@ -1126,16 +1126,30 @@
              /* Parse the SOCKS proxy host[:port] */
              p = vec[1];
  
@@ -2672,7 +2678,7 @@ diff -urNad privoxy~/loadcfg.c privoxy/loadcfg.c
              }
  
              /* Parse the parent HTTP proxy host[:port] */
-@@ -1137,16 +1151,26 @@
+@@ -1143,16 +1157,26 @@
  
              if (strcmp(p, ".") != 0)
              {
@@ -2703,7 +2709,7 @@ diff -urNad privoxy~/loadcfg.c privoxy/loadcfg.c
                    cur_fwd->forward_port = 8000;
                 }
              }
-@@ -1179,10 +1203,49 @@
+@@ -1185,10 +1209,49 @@
   * listen-address [ip][:port]
   * *************************************************************************/
           case hash_listen_address :
@@ -2756,7 +2762,7 @@ diff -urNad privoxy~/loadcfg.c privoxy/loadcfg.c
  /* *************************************************************************
   * logdir directory-name
   * *************************************************************************/
-@@ -1205,75 +1268,21 @@
+@@ -1211,75 +1274,21 @@
   * *************************************************************************/
  #ifdef FEATURE_ACL
           case hash_permit_access:
@@ -2813,10 +2819,10 @@ diff -urNad privoxy~/loadcfg.c privoxy/loadcfg.c
 -                     vec[0]);
 +               case 1:
 +                  config->acl = add_to_acl_list(config->acl, ACL_PERMIT, vec[0], NULL, &config->proxy_args);
-+                                              break;
++                  break;
 +               case 2:
 +                  config->acl = add_to_acl_list(config->acl, ACL_PERMIT, vec[0], vec[1], &config->proxy_args);
-+                                              break;
++                  break;
 +               default:
 +                  log_error(LOG_LEVEL_ERROR, "Wrong number of parameters for "
 +                            "permit-access directive in configuration file.");
@@ -2844,7 +2850,7 @@ diff -urNad privoxy~/loadcfg.c privoxy/loadcfg.c
              continue;
  #endif /* def FEATURE_ACL */
  
-@@ -1513,32 +1522,33 @@
+@@ -1519,32 +1528,33 @@
     }
  #endif /* def FEATURE_COOKIE_JAR */
  
@@ -2903,7 +2909,7 @@ diff -urNad privoxy~/loadcfg.c privoxy/loadcfg.c
     }
  
     /*
-@@ -1580,31 +1590,29 @@
+@@ -1586,31 +1596,29 @@
        struct configuration_spec * oldcfg = (struct configuration_spec *)
                                             current_configfile->f;
        /*
@@ -3005,7 +3011,7 @@ diff -urNad privoxy~/parsers.c privoxy/parsers.c
   *                Based on the Internet Junkbuster originally written
   *                by and Copyright (C) 1997 Anonymous Coders and
   *                Junkbusters Corporation.  http://www.junkbusters.com
-@@ -1932,6 +1935,167 @@
+@@ -1951,6 +1954,167 @@
     return JB_ERR_OK;
  }
  
@@ -3401,7 +3407,7 @@ diff -urNad privoxy~/urlmatch.c privoxy/urlmatch.c
           return JB_ERR_MEMORY;
        }
  
-+              http->host_port_malloc = buf;
++      http->host_port_malloc = buf;
 +
        /* check if url contains username and/or password */
 -      host = strchr(buf, '@');
@@ -3436,9 +3442,8 @@ diff -urNad privoxy~/urlmatch.c privoxy/urlmatch.c
        else
        {
           /* No port specified. */
--         http->port = (http->ssl ? 443 : 80);
 +         http->port_str = (http->ssl ? "143" : "80");
-+                      http->port = (http->ssl ? 443 : 80);
+          http->port = (http->ssl ? 443 : 80);
        }
  
 -      http->host = strdup(host);
@@ -3459,7 +3464,7 @@ diff -urNad privoxy~/urlmatch.c privoxy/urlmatch.c
  
     assert(url);
     assert(buf);
-@@ -685,22 +679,25 @@
+@@ -685,21 +679,24 @@
     {
        return JB_ERR_MEMORY;
     }
@@ -3480,6 +3485,11 @@ diff -urNad privoxy~/urlmatch.c privoxy/urlmatch.c
 +         }
 +         url->pathlen = strlen(url->path);
 +         *p = '\0';
++      }
++      else
++      {
++         url->path    = NULL;
++         url->pathlen = 0;
        }
 -      url->pathlen = strlen(url->path);
 -      *p = '\0';
@@ -3488,17 +3498,10 @@ diff -urNad privoxy~/urlmatch.c privoxy/urlmatch.c
 -   {
 -      url->path    = NULL;
 -      url->pathlen = 0;
--   }
-+      else
-+      {
-+         url->path    = NULL;
-+         url->pathlen = 0;
-+      }
-+      }
+    }
     if (url->path)
     {
-       int errcode;
-@@ -739,15 +736,12 @@
+@@ -739,14 +736,11 @@
           return JB_ERR_PARSE;
        }
     }
@@ -3511,14 +3514,12 @@ diff -urNad privoxy~/urlmatch.c privoxy/urlmatch.c
     {
 -      *p++ = '\0';
 -      url->port = atoi(p);
--   }
 +     char *p;
 +     parse_ip(buf,&buf,&p);
 +     url->port = atoi(p);
-+      }
+    }
  
     if (buf[0] != '\0')
-    {
 @@ -779,12 +773,13 @@
           return JB_ERR_MEMORY;
        }