- Added new function cgi_redirect to handle creation of
[privoxy.git] / miscutil.c
index fb8d4f0..d613d91 100644 (file)
@@ -1,4 +1,4 @@
-const char miscutil_rcs[] = "$Id: miscutil.c,v 1.37.2.1 2002/09/25 12:58:51 oes Exp $";
+const char miscutil_rcs[] = "$Id: miscutil.c,v 1.37.2.3 2003/11/20 11:39:24 oes Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/Attic/miscutil.c,v $
@@ -36,6 +36,12 @@ const char miscutil_rcs[] = "$Id: miscutil.c,v 1.37.2.1 2002/09/25 12:58:51 oes
  *
  * Revisions   :
  *    $Log: miscutil.c,v $
+ *    Revision 1.37.2.3  2003/11/20 11:39:24  oes
+ *    Bugfix: The "?" wildcard for domain names had never been implemented. Ooops\!
+ *
+ *    Revision 1.37.2.2  2002/11/12 14:28:18  oes
+ *    Proper backtracking in simplematch; fixes bug #632888
+ *
  *    Revision 1.37.2.1  2002/09/25 12:58:51  oes
  *    Made strcmpic and strncmpic safe against NULL arguments
  *    (which are now treated as empty strings).
@@ -767,7 +773,14 @@ int simplematch(char *pattern, char *text)
       /* EOF pattern but !EOF text? */
       if (*pat == '\0')
       {
-         return 1;
+         if (wildcard)
+         {
+            pat = fallback;
+         }
+         else
+         {
+            return 1;
+         }
       }
 
       /* '*' in the pattern?  */
@@ -819,8 +832,9 @@ int simplematch(char *pattern, char *text)
       /* 
        * Char match, or char range match? 
        */
-      if ((*pat == *txt)  
-      || ((*pat == ']') && (charmap[*txt / 8] & (1 << (*txt % 8)))) )
+      if ( (*pat == *txt)
+      ||   (*pat == '?')
+      ||   ((*pat == ']') && (charmap[*txt / 8] & (1 << (*txt % 8)))) )
       {
          /* 
           * Sucess: Go ahead
@@ -840,7 +854,6 @@ int simplematch(char *pattern, char *text)
           * Wildcard mode && nonmatch beyond fallback: Rewind pattern
           */
          pat = fallback;
-         continue;
       }
       txt++;
    }