Integrate a modified version of Wil Mahan's
[privoxy.git] / project.h
index bb7ee92..b021c62 100644 (file)
--- a/project.h
+++ b/project.h
@@ -1,7 +1,7 @@
 #ifndef PROJECT_H_INCLUDED
 #define PROJECT_H_INCLUDED
 /** Version string. */
-#define PROJECT_H_VERSION "$Id: project.h,v 1.79 2006/09/06 09:23:37 fabiankeil Exp $"
+#define PROJECT_H_VERSION "$Id: project.h,v 1.86 2006/12/31 17:56:37 fabiankeil Exp $"
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/project.h,v $
  *
  * Revisions   :
  *    $Log: project.h,v $
+ *    Revision 1.86  2006/12/31 17:56:37  fabiankeil
+ *    Added config option accept-intercepted-requests
+ *    and disabled it by default.
+ *
+ *    Revision 1.85  2006/12/31 15:03:31  fabiankeil
+ *    Fix gcc43 compiler warnings and a comment.
+ *
+ *    Revision 1.84  2006/12/21 12:57:48  fabiankeil
+ *    Add config option "split-large-forms"
+ *    to work around the browser bug reported
+ *    in BR #1570678.
+ *
+ *    Revision 1.83  2006/12/06 19:26:29  fabiankeil
+ *    Moved HTTP snipplets into jcc.c. They aren't
+ *    used anywhere else.
+ *
+ *    Revision 1.82  2006/09/20 15:50:31  fabiankeil
+ *    Doubled size of HOSTENT_BUFFER_SIZE to mask
+ *    problems with gethostbyname_r and some
+ *    /etc/hosts configurations. Only a workaround
+ *    until we get the real fix ready.
+ *    Thanks FĂ©lix Rauch for reporting.
+ *
+ *    Increased value of MAX_TRUSTED_REFERRERS from 64 to 512.
+ *
+ *    Revision 1.81  2006/09/06 13:03:04  fabiankeil
+ *    Respond with 400 and a short text message
+ *    if the client tries to use Privoxy as FTP proxy.
+ *
+ *    Revision 1.80  2006/09/06 10:43:32  fabiankeil
+ *    Added config option enable-remote-http-toggle
+ *    to specify if Privoxy should recognize special
+ *    headers (currently only X-Filter) to change its
+ *    behaviour. Disabled by default.
+ *
  *    Revision 1.79  2006/09/06 09:23:37  fabiankeil
  *    Make number of retries in case of forwarded-connect problems
  *    a config file option (forwarded-connect-retries) and use 0 as
@@ -602,7 +637,7 @@ typedef int jb_err;
 #define JB_ERR_PARSE      4 /**< Error parsing file                       */
 #define JB_ERR_MODIFIED   5 /**< File has been modified outside of the  
                                  CGI actions editor.                      */
-
+#define JB_ERR_COMPRESS   6 /**< Error on decompression                   */
 
 /**
  * This macro is used to free a pointer that may be NULL.
@@ -647,7 +682,12 @@ typedef int jb_err;
  * load balancing. W3C's wwwlib uses 1K, so that should be
  * good enough for us, too.
  */
-#define HOSTENT_BUFFER_SIZE 1024
+/**
+ * XXX: Temporary doubled, for some configurations
+ * 1K is still too small and we didn't get the
+ * real fix ready for inclusion.
+ */
+#define HOSTENT_BUFFER_SIZE 2048
 
 /**
  * Do not use.  Originally this was so that you can
@@ -795,7 +835,7 @@ struct url_spec
    int   port;         /**< The port number, or 0 to match all ports.         */
 
    char *path;         /**< The source for the regex.                         */
-   int   pathlen;      /**< ==strlen(path).  Needed for prefix matching.  FIXME: Now obsolete?     */
+   size_t pathlen;     /**< ==strlen(path).  Needed for prefix matching.  FIXME: Now obsolete?     */
    regex_t *preg;      /**< Regex for matching path part                      */
 };
 
@@ -849,15 +889,18 @@ struct iob
  */
 #define IOB_RESET(CSP) if(CSP->iob->buf) free(CSP->iob->buf); memset(CSP->iob, '\0', sizeof(CSP->iob));
 
-/* Bits for csp->content_type */
-#define CT_TEXT   1 /**< csp->content_type bitmask:
-                         Suitable for pcrs filtering. */
-#define CT_GIF    2 /**< csp->content_type bitmask:
-                         Suitable for GIF filtering.  */
-#define CT_TABOO  4 /**< csp->content_type bitmask:
-                         DO NOT filter, irrespective of other flags. */
-#define CT_JPEG   8 /**< csp->content_type bitmask:
-                         Suitable for JPEG filtering.  */
+/* Bits for csp->content_type bitmask: */
+#define CT_TEXT    0x0001U /**< Suitable for pcrs filtering. */
+#define CT_GIF     0x0002U /**< Suitable for GIF filtering.  */
+#define CT_TABOO   0x0004U /**< DO NOT filter, irrespective of other flags. */
+#define CT_JPEG    0x0008U /**< Suitable for JPEG filtering.  */
+
+/* Although these are not, strictly speaking, content types
+ * (they are content encodings), it is simple to handle them
+ * as such.
+ */
+#define CT_GZIP    0x0010U /**< gzip-compressed data. */
+#define CT_DEFLATE 0x0020U /**< zlib-compressed data. */
 
 /**
  * The mask which includes all actions.
@@ -1128,7 +1171,7 @@ struct client_state
    jb_socket sfd;
 
    /** Multi-purpose flag container, see CSP_FLAG_* above */
-   unsigned short int flags;
+   unsigned int flags;
 
    /** Client PC's IP address, as reported by the accept() function.
        As a string. */
@@ -1158,7 +1201,7 @@ struct client_state
    struct list cookie_list[1];
 
    /** MIME-Type key, see CT_* above */
-   unsigned short int content_type;
+   unsigned int content_type;
 
    /** The "X-Forwarded-For:" header sent by the client */
    char   *x_forwarded;
@@ -1291,10 +1334,9 @@ struct block_spec
 };
 
 /**
- * Arbitrary limit for the number of trusted referrers
- * Privoxy can print in its blocking message.
+ * Arbitrary limit for the number of trusted referrers.
  */
-#define MAX_TRUSTED_REFERRERS 64
+#define MAX_TRUSTED_REFERRERS 512
 
 #endif /* def FEATURE_TRUST */
 
@@ -1391,13 +1433,20 @@ struct access_control_list
 
 
 /** configuration_spec::feature_flags: CGI actions editor. */
-#define RUNTIME_FEATURE_CGI_EDIT_ACTIONS  1
+#define RUNTIME_FEATURE_CGI_EDIT_ACTIONS             1
 
 /** configuration_spec::feature_flags: Web-based toggle. */
-#define RUNTIME_FEATURE_CGI_TOGGLE        2
+#define RUNTIME_FEATURE_CGI_TOGGLE                   2
 
 /** configuration_spec::feature_flags: HTTP-header-based toggle. */
-#define RUNTIME_FEATURE_HTTP_TOGGLE       4
+#define RUNTIME_FEATURE_HTTP_TOGGLE                  4
+
+/** configuration_spec::feature_flags: Split large forms to limit the number of GET arguments. */
+#define RUNTIME_FEATURE_SPLIT_LARGE_FORMS            8
+
+/** configuration_spec::feature_flags: Check the host header for requests with host-less request lines. */
+#define RUNTIME_FEATURE_ACCEPT_INTERCEPTED_REQUESTS 16
+
 
 /**
  * Data loaded from the configuration file.
@@ -1419,6 +1468,7 @@ struct configuration_spec
     * - RUNTIME_FEATURE_CGI_EDIT_ACTIONS
     * - RUNTIME_FEATURE_CGI_TOGGLE
     * - RUNTIME_FEATURE_HTTP_TOGGLE
+    * - RUNTIME_FEATURE_SPLIT_LARGE_FORMS
     */
    unsigned feature_flags;
 
@@ -1561,22 +1611,6 @@ struct configuration_spec
  */
 #define CGI_PREFIX  "http://" CGI_SITE_2_HOST CGI_SITE_2_PATH "/"
 
-
-/* HTTP snipplets.
- *
- * FIXME: This is very inefficient.  There could be one copy of these strings
- * for each .c file!!  They should be "extern", not "static".
- */
-static const char CSUCCEED[] =
-   "HTTP/1.0 200 Connection established\n"
-   "Proxy-Agent: Privoxy/" VERSION "\r\n\r\n";
-
-static const char CHEADER[] =
-   "HTTP/1.0 400 Invalid header received from browser\r\n\r\n";
-
-static const char CFORBIDDEN[] =
-   "HTTP/1.0 403 Connection not allowable\r\nX-Hint: If you read this message interactively, then you know why this happens ,-)\r\n\r\n";
-
 #ifdef __cplusplus
 } /* extern "C" */
 #endif