Deleted config.h and pcrs/chartables.h because they are auto
[privoxy.git] / loadcfg.c
index 185241b..e85f47e 100644 (file)
--- a/loadcfg.c
+++ b/loadcfg.c
@@ -1,4 +1,4 @@
-const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.2 2001/05/17 23:01:01 oes Exp $";
+const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.3 2001/05/20 01:21:20 jongfoster Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/loadcfg.c,v $
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/loadcfg.c,v $
@@ -35,6 +35,19 @@ const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.2 2001/05/17 23:01:01 oes Exp $";
  *
  * Revisions   :
  *    $Log: loadcfg.c,v $
  *
  * Revisions   :
  *    $Log: loadcfg.c,v $
+ *    Revision 1.3  2001/05/20 01:21:20  jongfoster
+ *    Version 2.9.4 checkin.
+ *    - Merged popupfile and cookiefile, and added control over PCRS
+ *      filtering, in new "permissionsfile".
+ *    - Implemented LOG_LEVEL_FATAL, so that if there is a configuration
+ *      file error you now get a message box (in the Win32 GUI) rather
+ *      than the program exiting with no explanation.
+ *    - Made killpopup use the PCRS MIME-type checking and HTTP-header
+ *      skipping.
+ *    - Removed tabs from "config"
+ *    - Moved duplicated url parsing code in "loaders.c" to a new funcition.
+ *    - Bumped up version number.
+ *
  *    Revision 1.2  2001/05/17 23:01:01  oes
  *     - Cleaned CRLF's from the sources and related files
  *
  *    Revision 1.2  2001/05/17 23:01:01  oes
  *     - Cleaned CRLF's from the sources and related files
  *
@@ -143,16 +156,20 @@ const char *aclfile     = NULL;
 #ifdef USE_IMAGE_LIST
 const char *imagefile   = NULL;
 #endif /* def USE_IMAGE_LIST */
 #ifdef USE_IMAGE_LIST
 const char *imagefile   = NULL;
 #endif /* def USE_IMAGE_LIST */
-\r
-/*\r
- * Permissions to use for URLs not in the permissions list.\r
+
+/*
+ * Permissions to use for URLs not in the permissions list.
  */
  */
-int default_permissions = PERMIT_RE_FILTER;\r
+int default_permissions = PERMIT_RE_FILTER;
 
 #ifdef PCRS
 const char *re_filterfile = NULL;
 #endif /* def PCRS */
 
 
 #ifdef PCRS
 const char *re_filterfile = NULL;
 #endif /* def PCRS */
 
+#ifdef FAST_REDIRECTS
+int fast_redirects = 0;
+#endif /* def FAST_REDIRECTS */
+
 #ifdef TRUST_FILES
 const char *trustfile   = NULL;
 #endif /* def TRUST_FILES */
 #ifdef TRUST_FILES
 const char *trustfile   = NULL;
 #endif /* def TRUST_FILES */
@@ -212,7 +229,7 @@ const char **Argv = NULL;
  * something a little more readable.  This also makes changing the
  * hash values easier if they should change or the hash algorthm changes.
  * Use the included "hash" program to find out what the hash will be
  * something a little more readable.  This also makes changing the
  * hash values easier if they should change or the hash algorthm changes.
  * Use the included "hash" program to find out what the hash will be
- * for any string supplied on the command line.  (Or just put it in the\r
+ * for any string supplied on the command line.  (Or just put it in the
  * config file and read the number from the error message in the log).
  */
 
  * config file and read the number from the error message in the log).
  */
 
@@ -225,7 +242,7 @@ const char **Argv = NULL;
 #define hash_suppress_vanilla_wafer    3121233547ul
 #define hash_wafer                     89669ul
 #define hash_add_header                237434619ul
 #define hash_suppress_vanilla_wafer    3121233547ul
 #define hash_wafer                     89669ul
 #define hash_add_header                237434619ul
-#define hash_permissions_file          3825730796lu /* "permissionsfile" */\r
+#define hash_permissions_file          3825730796lu /* "permissionsfile" */
 #define hash_logfile                   2114766ul
 #define hash_blockfile                 48845391ul
 #define hash_imagefile                 51447891ul
 #define hash_logfile                   2114766ul
 #define hash_blockfile                 48845391ul
 #define hash_imagefile                 51447891ul
@@ -238,6 +255,7 @@ const char **Argv = NULL;
 #define hash_referrer                  10883969ul
 #define hash_referer                   2176719ul
 #define hash_from                      16264ul
 #define hash_referrer                  10883969ul
 #define hash_referer                   2176719ul
 #define hash_from                      16264ul
+#define hash_fast_redirects            464873764lu
 #define hash_hide_console              2048809870ul
 #define hash_include_stats             2174146548ul
 #define hash_suppress_blocklists       1948693308ul
 #define hash_hide_console              2048809870ul
 #define hash_include_stats             2174146548ul
 #define hash_suppress_blocklists       1948693308ul
@@ -267,7 +285,7 @@ const char **Argv = NULL;
  * Returns     :  configret : 0 => Ok, everything else is an error.
  *                Note: we use configret since a signal handler cannot
  *                return a value, and this function does double duty.
  * Returns     :  configret : 0 => Ok, everything else is an error.
  *                Note: we use configret since a signal handler cannot
  *                return a value, and this function does double duty.
- *                Ie. Is is called from main and from signal( SIGHUP );\r
+ *                Ie. Is is called from main and from signal( SIGHUP );
  *
  *********************************************************************/
 void load_config( int signum )
  *
  *********************************************************************/
 void load_config( int signum )
@@ -309,8 +327,8 @@ void load_config( int signum )
 #endif /* def JAR_FILES */
 
    debug             = 0;
 #endif /* def JAR_FILES */
 
    debug             = 0;
-   multi_threaded    = 1;\r
-\r
+   multi_threaded    = 1;
+
    default_permissions = PERMIT_RE_FILTER;
 
 #if defined(DETECT_MSIE_IMAGES) || defined(USE_IMAGE_LIST)
    default_permissions = PERMIT_RE_FILTER;
 
 #if defined(DETECT_MSIE_IMAGES) || defined(USE_IMAGE_LIST)
@@ -374,13 +392,17 @@ void load_config( int signum )
    freez((char *)re_filterfile);
 #endif /* def PCRS */
 
    freez((char *)re_filterfile);
 #endif /* def PCRS */
 
+#ifdef FAST_REDIRECTS
+   fast_redirects = 0;
+#endif /* def FAST_REDIRECTS */
+
    if (NULL != configfile)
    {
       if ((configfp = fopen(configfile, "r")) == NULL)
       {
          log_error(LOG_LEVEL_FATAL, "can't open configuration file '%s':  %E",
                  configfile);
    if (NULL != configfile)
    {
       if ((configfp = fopen(configfile, "r")) == NULL)
       {
          log_error(LOG_LEVEL_FATAL, "can't open configuration file '%s':  %E",
                  configfile);
-         /* Never get here - LOG_LEVEL_FATAL causes program exit */\r
+         /* Never get here - LOG_LEVEL_FATAL causes program exit */
       }
    }
 
       }
    }
 
@@ -577,6 +599,12 @@ void load_config( int signum )
                from = strdup(arg);
                continue;
 
                from = strdup(arg);
                continue;
 
+#ifdef FAST_REDIRECTS
+                          case hash_fast_redirects :
+               fast_redirects = 1;
+               continue;
+#endif /* def FAST_REDIRECTS */
+
 #ifdef _WIN_CONSOLE
             case hash_hide_console :
                hideConsole = 1;
 #ifdef _WIN_CONSOLE
             case hash_hide_console :
                hideConsole = 1;
@@ -689,11 +717,11 @@ void load_config( int signum )
                continue;
 
             default :
                continue;
 
             default :
-               /*\r
-                * I decided that I liked this better as a warning than an\r
-                * error.  To change back to an error, just change log level\r
-                * to LOG_LEVEL_FATAL.\r
-                */\r
+               /*
+                * I decided that I liked this better as a warning than an
+                * error.  To change back to an error, just change log level
+                * to LOG_LEVEL_FATAL.
+                */
                log_error(LOG_LEVEL_ERROR, "Unrecognized directive (%lulu) in "
                      "configuration file: \"%s\"", hash_string( cmd ), buf);
                p = malloc( BUFSIZ );
                log_error(LOG_LEVEL_ERROR, "Unrecognized directive (%lulu) in "
                      "configuration file: \"%s\"", hash_string( cmd ), buf);
                p = malloc( BUFSIZ );
@@ -786,7 +814,7 @@ void load_config( int signum )
       {
          *--p = ':';
          log_error(LOG_LEVEL_FATAL, "invalid bind port spec %s", haddr);
       {
          *--p = ':';
          log_error(LOG_LEVEL_FATAL, "invalid bind port spec %s", haddr);
-         /* Never get here - LOG_LEVEL_FATAL causes program exit */\r
+         /* Never get here - LOG_LEVEL_FATAL causes program exit */
       }
       if (*haddr == '\0')
       {
       }
       if (*haddr == '\0')
       {
@@ -796,8 +824,8 @@ void load_config( int signum )
 
    if (run_loader(NULL))
    {
 
    if (run_loader(NULL))
    {
-      log_error(LOG_LEVEL_FATAL, "A loader failed while loading config file. Exiting.");\r
-      /* Never get here - LOG_LEVEL_FATAL causes program exit */\r
+      log_error(LOG_LEVEL_FATAL, "A loader failed while loading config file. Exiting.");
+      /* Never get here - LOG_LEVEL_FATAL causes program exit */
    }
 
 #ifdef JAR_FILES
    }
 
 #ifdef JAR_FILES