Deleted config.h and pcrs/chartables.h because they are auto
[privoxy.git] / project.h
index 4941582..28511c9 100644 (file)
--- a/project.h
+++ b/project.h
@@ -1,6 +1,6 @@
 #ifndef _PROJECT_H
 #define _PROJECT_H
-#define PROJECT_H_VERSION "$Id: project.h,v 1.1.1.1 2001/05/15 13:59:03 oes Exp $"
+#define PROJECT_H_VERSION "$Id: project.h,v 1.3 2001/05/20 01:21:20 jongfoster Exp $"
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/project.h,v $
  *
  * Revisions   :
  *    $Log: project.h,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.1.1.1  2001/05/15 13:59:03  oes
  *    Initial import of version 2.9.3 source tree
  *
@@ -115,7 +131,6 @@ struct http_request
    int   ssl;
 };
 
-
 struct gateway
 {
    /* generic attributes */
@@ -185,8 +200,8 @@ struct list
 
 struct client_state
 {
-   int  send_user_cookie;
-   int  accept_server_cookie;
+   int  permissions;
+   
    int  cfd;
    int  sfd;
 
@@ -228,9 +243,9 @@ struct client_state
 
    struct list headers[1];
    struct list cookie_list[1];
-#ifdef PCRS
+#if defined(PCRS) || defined(KILLPOPUPS)
    int is_text;
-#endif /* def PCRS */
+#endif /* defined(PCRS) || defined(KILLPOPUPS) */
 
    char   *x_forwarded;
 
@@ -238,8 +253,9 @@ struct client_state
 
    /* files associated with this client */
    struct file_list *blist;   /* blockfile */
-   struct file_list *clist;   /* cookiefile */
    struct file_list *flist;   /* forwardfile */
+   struct file_list *permissions_list;
+
 
 #ifdef ACL_FILES
    struct file_list *alist;   /* aclfile */
@@ -249,10 +265,6 @@ struct client_state
    struct file_list *ilist;   /* imagefile */
 #endif /* def USE_IMAGE_LIST */
 
-#ifdef KILLPOPUPS
-   struct file_list *plist;   /* kill popup file */
-#endif /* def KILLPOPUPS */
-
 #ifdef PCRS
      struct file_list *rlist;   /* Perl re_filterfile */
 #endif /* def PCRS */
@@ -346,20 +358,23 @@ struct file_list
 struct block_spec
 {
    struct url_spec url[1];
-   int   reject;
+   int    reject;
    struct block_spec *next;
 };
 
 
-struct cookie_spec
+#define PERMIT_COOKIE_SET    0x0001
+#define PERMIT_COOKIE_READ   0x0002
+#define PERMIT_RE_FILTER     0x0004
+#define PERMIT_POPUPS        0x0008
+
+struct permissions_spec
 {
-   struct url_spec url[1];
-   int   send_user_cookie;
-   int   accept_server_cookie;
-   struct cookie_spec *next;
+   struct url_spec           url[1];
+   int                       permissions;
+   struct permissions_spec * next;
 };
 
-
 struct forward_spec
 {
    struct url_spec url[1];
@@ -379,22 +394,6 @@ struct re_filterfile_spec
 #endif /* def PCRS */
 
 
-#ifdef KILLPOPUPS
-/* Entries on popup blocklist */
-struct popup_blocklist
-{
-   char *host_name;
-   struct popup_blocklist *next;
-};
-
-/* Actual type used in file object */
-struct popup_settings
-{
-   struct popup_blocklist *blocked;
-   struct popup_blocklist *allowed;
-};
-#endif /* def KILLPOPUPS */
-
 #ifdef ACL_FILES
 #define ACL_PERMIT   1  /* accept connection request */
 #define ACL_DENY     2  /* reject connection request */
@@ -423,20 +422,113 @@ struct access_control_list
 #define BANNER    "<strong>Internet J<small>UNK<i><font color=\"red\">BUSTER</font></i></small></strong>"
 
 #ifdef FORCE_LOAD
-/*
- * FIXME: Unfortunately, IE lowercases the domain name.  JunkBuster does
- * a case-sensitive compare.  JunkBuster should be modified to do a
- * case-insensitive compatison.  As a temporary workaround, I've lowercased
- * the FORCE_PREFIX.
- *
- * #define FORCE_PREFIX "IJB-FORCE-LOAD-"
- */
-#define FORCE_PREFIX "ijb-force-load-"
+#define FORCE_PREFIX "/IJB-FORCE-LOAD"
 #endif /* def FORCE_LOAD */
 
 #define HOME_PAGE_URL  "http://ijbswa.sourceforge.net/"
 #define REDIRECT_URL HOME_PAGE_URL "redirect.php?v=" VERSION "&to="
 
+static const char CFAIL[] =
+   "HTTP/1.0 503 Connect failed\n"
+   "Content-Type: text/html\n\n"
+   "<html>\n"
+   "<head>\n"
+   "<title>Internet Junkbuster: Connect failed</title>\n"
+   "</head>\n"
+   BODY
+   "<h1><center>"
+   BANNER
+   "</center></h1>"
+   "TCP connection to '%s' failed: %s.\n<br>"
+   "</body>\n"
+   "</html>\n";
+
+static const char CNXDOM[] =
+   "HTTP/1.0 404 Non-existent domain\n"
+   "Content-Type: text/html\n\n"
+   "<html>\n"
+   "<head>\n"
+   "<title>Internet Junkbuster: Non-existent domain</title>\n"
+   "</head>\n"
+   BODY
+   "<h1><center>"
+   BANNER
+   "</center></h1>"
+   "No such domain: %s\n"
+   "</body>\n"
+   "</html>\n";
+
+static const char CNOBANNER[] =
+   "HTTP/1.0 200 No Banner\n"
+   "Content-Type: text/html\n\n"
+   "<html>\n"
+   "<head>\n"
+   "<title>Internet Junkbuster: No Banner</title>\n"
+   "</head>\n"
+   BODY
+   "<h1><center>"
+   BANNER
+   "</h1>"
+   "You asked for a banner that this proxy can't produce because either configuration does not permit.\n<br>"
+   "or the URL didn't end with .gif\n"
+   "</center></body>\n"
+   "</html>\n";
+
+static const char CSUCCEED[] =
+   "HTTP/1.0 200 Connection established\n"
+   "Proxy-Agent: IJ/" VERSION "\n\n";
+
+static const char CHEADER[] =
+   "HTTP/1.0 400 Invalid header received from browser\n\n";
+
+static const char SHEADER[] =
+   "HTTP/1.0 502 Invalid header received from server\n\n";
+
+#if defined(DETECT_MSIE_IMAGES) || defined(USE_IMAGE_LIST)
+
+/*
+ * Hint: You can encode your own GIFs like that:
+ * perl -e 'while (read STDIN, $c, 1) { printf("\\%.3o,", unpack("C", $c)); }'
+ */
+
+static const char BLANKGIF[] =
+   "HTTP/1.0 200 OK\r\n"
+   "Pragma: no-cache\r\n"
+   "Last-Modified: Thu Jul 31, 1997 07:42:22 pm GMT\r\n"
+   "Expires:       Thu Jul 31, 1997 07:42:22 pm GMT\r\n"
+   "Content-type: image/gif\r\n\r\n"
+   "GIF89a\001\000\001\000\200\000\000\377\377\377\000\000"
+   "\000!\371\004\001\000\000\000\000,\000\000\000\000\001"
+   "\000\001\000\000\002\002D\001\000;";
+
+static const char JBGIF[] =
+   "HTTP/1.0 200 OK\r\n"
+   "Pragma: no-cache\r\n"
+   "Last-Modified: Thu Jul 31, 1997 07:42:22 pm GMT\r\n"
+   "Expires:       Thu Jul 31, 1997 07:42:22 pm GMT\r\n"
+   "Content-type: image/gif\r\n\r\n"
+   "GIF89aD\000\013\000\360\000\000\000\000\000\377\377\377!"
+   "\371\004\001\000\000\001\000,\000\000\000\000D\000\013\000"
+   "\000\002a\214\217\251\313\355\277\000\200G&K\025\316hC\037"
+   "\200\234\230Y\2309\235S\230\266\206\372J\253<\3131\253\271"
+   "\270\215\342\254\013\203\371\202\264\334P\207\332\020o\266"
+   "N\215I\332=\211\312\3513\266:\026AK)\364\370\365aobr\305"
+   "\372\003S\275\274k2\354\254z\347?\335\274x\306^9\374\276"
+   "\037Q\000\000;";
+
+#endif /* defined(DETECT_MSIE_IMAGES) || defined(USE_IMAGE_LIST) */
+
+#if defined(FAST_REDIRECTS) || defined(DETECT_MSIE_IMAGES) || defined(USE_IMAGE_LIST)
+
+static const char HTTP_REDIRECT_TEMPLATE[] =
+      "HTTP/1.0 302 Local Redirect from Junkbuster\r\n" 
+      "Pragma: no-cache\r\n"
+      "Last-Modified: Thu Jul 31, 1997 07:42:22 pm GMT\r\n"
+      "Expires:       Thu Jul 31, 1997 07:42:22 pm GMT\r\n"
+      "Location: %s\r\n";
+
+#endif /*  defined(DETECT_MSIE_IMAGES) || defined(USE_IMAGE_LIST) */
+
 #ifdef __cplusplus
 } /* extern "C" */
 #endif