Cosmetic: 2 spaces -> 1 space
[privoxy.git] / project.h
1 #ifndef _PROJECT_H
2 #define _PROJECT_H
3 #define PROJECT_H_VERSION "$Id: project.h,v 1.23 2001/07/18 12:32:23 oes Exp $"
4 /*********************************************************************
5  *
6  * File        :  $Source: /cvsroot/ijbswa/current/project.h,v $
7  *
8  * Purpose     :  Defines data structures which are widely used in the
9  *                project.  Does not define any variables or functions
10  *                (though it does declare some macros).
11  *
12  * Copyright   :  Written by and Copyright (C) 2001 the SourceForge
13  *                IJBSWA team.  http://ijbswa.sourceforge.net
14  *
15  *                Based on the Internet Junkbuster originally written
16  *                by and Copyright (C) 1997 Anonymous Coders and 
17  *                Junkbusters Corporation.  http://www.junkbusters.com
18  *
19  *                This program is free software; you can redistribute it 
20  *                and/or modify it under the terms of the GNU General
21  *                Public License as published by the Free Software
22  *                Foundation; either version 2 of the License, or (at
23  *                your option) any later version.
24  *
25  *                This program is distributed in the hope that it will
26  *                be useful, but WITHOUT ANY WARRANTY; without even the
27  *                implied warranty of MERCHANTABILITY or FITNESS FOR A
28  *                PARTICULAR PURPOSE.  See the GNU General Public
29  *                License for more details.
30  *
31  *                The GNU General Public License should be included with
32  *                this file.  If not, you can view it at
33  *                http://www.gnu.org/copyleft/gpl.html
34  *                or write to the Free Software Foundation, Inc., 59
35  *                Temple Place - Suite 330, Boston, MA  02111-1307, USA.
36  *
37  * Revisions   :
38  *    $Log: project.h,v $
39  *    Revision 1.23  2001/07/18 12:32:23  oes
40  *    - Added ACTION_STRING_DEANIMATE
41  *    - moved #define freez from jcc.h to project.h
42  *
43  *    Revision 1.22  2001/07/15 17:51:41  jongfoster
44  *    Renaming #define STATIC to STATIC_PCRE
45  *
46  *    Revision 1.21  2001/07/13 14:03:19  oes
47  *     - Reorganized regex header inclusion and #defines to
48  *       comply to the scheme in configure.in
49  *     - Added csp->content_type and its CT_* keys
50  *     - Added ACTION_DEANIMATE
51  *     - Removed all #ifdef PCRS
52  *
53  *    Revision 1.20  2001/06/29 21:45:41  oes
54  *    Indentation, CRLF->LF, Tab-> Space
55  *
56  *    Revision 1.19  2001/06/29 13:33:36  oes
57  *    - Improved comments
58  *    - Introduced http_request.host_ip_addr_str
59  *    - Introduced http_response.head_length
60  *    - Introduced config.my_ip_addr_str, config.my_hostname,
61  *      config.admin_address and config.proxy_info_url
62  *    - Removed config.proxy_args_header and config.proxy_args_trailer,
63  *      renamed config.proxy_args_invocation to config.proxy_args
64  *    - Removed HTML snipplets and GIFs
65  *    - Removed logentry from cancelled commit
66  *
67  *    Revision 1.18  2001/06/09 10:57:39  jongfoster
68  *    Adding definition of BUFFER_SIZE.
69  *    Changing struct cgi_dispatcher to use "const" strings.
70  *
71  *    Revision 1.17  2001/06/07 23:15:09  jongfoster
72  *    Merging ACL and forward files into config file.
73  *    Moving struct gateway members into struct forward_spec
74  *    Removing config->proxy_args_gateways
75  *    Cosmetic: Adding a few comments
76  *
77  *    Revision 1.16  2001/06/04 18:31:58  swa
78  *    files are now prefixed with either `confdir' or `logdir'.
79  *    `make redhat-dist' replaces both entries confdir and logdir
80  *    with redhat values
81  *
82  *    Revision 1.15  2001/06/04 11:28:53  swa
83  *    redirect did not work due to missing /
84  *
85  *    Revision 1.14  2001/06/03 11:03:48  oes
86  *    Added struct map,
87  *    added struct http_response,
88  *    changed struct interceptors to struct cgi_dispatcher,
89  *    moved HTML stuff to cgi.h
90  *
91  *    Revision 1.13  2001/06/01 20:05:36  jongfoster
92  *    Support for +image-blocker{}: added ACTION_IMAGE_BLOCKER
93  *    constant, and removed csp->tinygif.
94  *
95  *    Revision 1.12  2001/06/01 18:49:17  jongfoster
96  *    Replaced "list_share" with "list" - the tiny memory gain was not
97  *    worth the extra complexity.
98  *
99  *    Revision 1.11  2001/06/01 10:32:47  oes
100  *    Added constants for anchoring selection bitmap
101  *
102  *    Revision 1.10  2001/05/31 21:33:53  jongfoster
103  *    Changes for new actions file, replacing permissionsfile
104  *    and parts of the config file.  Also added support for
105  *    list_shared.
106  *
107  *    Revision 1.9  2001/05/31 17:32:31  oes
108  *
109  *     - Enhanced domain part globbing with infix and prefix asterisk
110  *       matching and optional unanchored operation
111  *
112  *    Revision 1.8  2001/05/29 20:09:15  joergs
113  *    HTTP_REDIRECT_TEMPLATE fixed.
114  *
115  *    Revision 1.7  2001/05/29 09:50:24  jongfoster
116  *    Unified blocklist/imagelist/actionslist.
117  *    File format is still under discussion, but the internal changes
118  *    are (mostly) done.
119  *
120  *    Also modified interceptor behaviour:
121  *    - We now intercept all URLs beginning with one of the following
122  *      prefixes (and *only* these prefixes):
123  *        * http://i.j.b/
124  *        * http://ijbswa.sf.net/config/
125  *        * http://ijbswa.sourceforge.net/config/
126  *    - New interceptors "home page" - go to http://i.j.b/ to see it.
127  *    - Internal changes so that intercepted and fast redirect pages
128  *      are not replaced with an image.
129  *    - Interceptors now have the option to send a binary page direct
130  *      to the client. (i.e. ijb-send-banner uses this)
131  *    - Implemented show-url-info interceptor.  (Which is why I needed
132  *      the above interceptors changes - a typical URL is
133  *      "http://i.j.b/show-url-info?url=www.somesite.com/banner.gif".
134  *      The previous mechanism would not have intercepted that, and
135  *      if it had been intercepted then it then it would have replaced
136  *      it with an image.)
137  *
138  *    Revision 1.6  2001/05/27 22:17:04  oes
139  *
140  *    - re_process_buffer no longer writes the modified buffer
141  *      to the client, which was very ugly. It now returns the
142  *      buffer, which it is then written by chat.
143  *
144  *    - content_length now adjusts the Content-Length: header
145  *      for modified documents rather than crunch()ing it.
146  *      (Length info in csp->content_length, which is 0 for
147  *      unmodified documents)
148  *
149  *    - For this to work, sed() is called twice when filtering.
150  *
151  *    Revision 1.5  2001/05/26 00:28:36  jongfoster
152  *    Automatic reloading of config file.
153  *    Removed obsolete SIGHUP support (Unix) and Reload menu option (Win32).
154  *    Most of the global variables have been moved to a new
155  *    struct configuration_spec, accessed through csp->config->globalname
156  *    Most of the globals remaining are used by the Win32 GUI.
157  *
158  *    Revision 1.4  2001/05/22 18:46:04  oes
159  *
160  *    - Enabled filtering banners by size rather than URL
161  *      by adding patterns that replace all standard banner
162  *      sizes with the "Junkbuster" gif to the re_filterfile
163  *
164  *    - Enabled filtering WebBugs by providing a pattern
165  *      which kills all 1x1 images
166  *
167  *    - Added support for PCRE_UNGREEDY behaviour to pcrs,
168  *      which is selected by the (nonstandard and therefore
169  *      capital) letter 'U' in the option string.
170  *      It causes the quantifiers to be ungreedy by default.
171  *      Appending a ? turns back to greedy (!).
172  *
173  *    - Added a new interceptor ijb-send-banner, which
174  *      sends back the "Junkbuster" gif. Without imagelist or
175  *      MSIE detection support, or if tinygif = 1, or the
176  *      URL isn't recognized as an imageurl, a lame HTML
177  *      explanation is sent instead.
178  *
179  *    - Added new feature, which permits blocking remote
180  *      script redirects and firing back a local redirect
181  *      to the browser.
182  *      The feature is conditionally compiled, i.e. it
183  *      can be disabled with --disable-fast-redirects,
184  *      plus it must be activated by a "fast-redirects"
185  *      line in the config file, has its own log level
186  *      and of course wants to be displayed by show-proxy-args
187  *      Note: Boy, all the #ifdefs in 1001 locations and
188  *      all the fumbling with configure.in and acconfig.h
189  *      were *way* more work than the feature itself :-(
190  *
191  *    - Because a generic redirect template was needed for
192  *      this, tinygif = 3 now uses the same.
193  *
194  *    - Moved GIFs, and other static HTTP response templates
195  *      to project.h
196  *
197  *    - Some minor fixes
198  *
199  *    - Removed some >400 CRs again (Jon, you really worked
200  *      a lot! ;-)
201  *
202  *    Revision 1.3  2001/05/20 01:21:20  jongfoster
203  *    Version 2.9.4 checkin.
204  *    - Merged popupfile and cookiefile, and added control over PCRS
205  *      filtering, in new "actionsfile".
206  *    - Implemented LOG_LEVEL_FATAL, so that if there is a configuration
207  *      file error you now get a message box (in the Win32 GUI) rather
208  *      than the program exiting with no explanation.
209  *    - Made killpopup use the PCRS MIME-type checking and HTTP-header
210  *      skipping.
211  *    - Removed tabs from "config"
212  *    - Moved duplicated url parsing code in "loaders.c" to a new funcition.
213  *    - Bumped up version number.
214  *
215  *    Revision 1.2  2001/05/17 23:01:01  oes
216  *     - Cleaned CRLF's from the sources and related files
217  *
218  *    Revision 1.1.1.1  2001/05/15 13:59:03  oes
219  *    Initial import of version 2.9.3 source tree
220  *
221  *
222  *********************************************************************/
223 \f
224
225 /* Declare struct FILE for vars and funcs. */
226 #include <stdio.h>
227
228 /* Need time_t for file_list */
229 #include <time.h>
230
231 /*
232  * Include appropriate regular expression libraries.
233  * Note that pcrs and pcre (native) are needed for cgi
234  * and are included anyway.
235  */
236
237 #if defined(REGEX_PCRE) || defined (REGEX_GNU)
238 # define REGEX
239 #endif /* defined(REGEX_PCRE) || defined (REGEX_GNU) */
240
241 #ifdef STATIC_PCRE
242 #  include "pcre.h"
243 #else
244 #  include <pcre.h>
245 #endif
246
247 #ifdef STATIC_PCRS
248 #  include "pcrs.h" 
249 #else
250 #  include <pcrs.h> 
251 #endif
252
253 #if defined(REGEX_PCRE)
254 #  ifdef STATIC_PCRE
255 #    include "pcreposix.h"
256 #  else
257 #    include <pcreposix.h>
258 #  endif
259 #endif /* defined(REGEX_PCRE) */
260
261 #if defined(REGEX_GNU)
262 #  include "gnu_regex.h"
263 #endif
264
265 #ifdef AMIGA 
266 #include "amiga.h" 
267 #endif /* def AMIGA */
268
269 #ifdef __cplusplus
270 extern "C" {
271 #endif
272
273 #define freez(X)  if(X) free(X); X = NULL
274
275 #define BUFFER_SIZE 5000
276
277 #define FOREVER 1
278
279 /* Default IP and port to listen on */
280 #define HADDR_DEFAULT   "127.0.0.1"
281 #define HADDR_PORT      8000
282
283
284 /* Need this for struct client_state */
285 struct configuration_spec;
286
287 /* Generic linked list of strings */
288 struct list /* FIXME: Why not separate entries and header? */
289 {
290    char *       str;  /* valid in an entry */
291    struct list *last; /* valid in header */
292    struct list *next;
293 };
294
295 struct map
296 {
297   char *name;
298   char *value;
299   struct map *next;
300 };
301
302 struct http_request
303 {
304    char *cmd;
305    char *gpc;
306    char *host;
307    char *host_ip_addr_str; /* NULL before connect_to() */
308    int   port;
309    char *path;
310    char *ver;
311    char *hostport; /* "host[:port]" */
312    int   ssl;
313    char *user_agent; /* Client's User-Agent: header value */
314 };
315
316 /* Response generated by CGI, blocker, or error handler */
317 struct http_response
318 {
319   char *status;           /* HTTP status (string)*/
320   struct list headers[1]; /* List of header lines */
321   char *head;             /* Formatted http response head */
322   int   head_length;      /* Length of http response head */
323   char *body;             /* HTTP document body */
324   int   content_length;   /* Length of body, REQUIRED if binary body*/
325 };
326
327 /* A URL pattern */
328 struct url_spec
329 {
330    char  *spec;        /* The string which was parsed to produce this       */
331                        /* url_spec.  Used for debugging or display only.    */
332
333    /* Hostname matching: */
334    char  *domain;      /* Fully qalified domain name (FQDN) pattern.        */
335                        /* May contain "*".                                  */
336    char  *dbuf;        /* Buffer with '\0'-delimited fqdn                   */
337    char **dvec;        /* Domain ptr vector into dbuf                       */
338    int    dcnt;        /* How many domains in fqdn?                         */
339    int    unanchored;  /* Bitmap - flags are ANCHOR_LEFT and ANCHOR_RIGHT   */
340
341    /* Port matching: */
342    int   port;         /* The port number, or 0 to match all ports.         */
343
344    /* Path matching: */
345    char *path;         /* The path prefix (if not using regex), or source   */
346                        /* for the regex.                                    */
347    int   pathlen;      /* ==strlen(path).  Needed for prefix matching.      */
348 #ifdef REGEX
349    regex_t *preg;      /* Regex for matching path part                      */
350 #endif
351 };
352
353 /* Constants for host part matching in URLs */
354 #define ANCHOR_LEFT  1
355 #define ANCHOR_RIGHT 2
356
357
358 /* An I/O buffer */
359 struct iob
360 {
361    char *buf;
362    char *cur;
363    char *eod;
364 };
365
366
367 #define IOB_PEEK(CSP) ((CSP->iob->cur > CSP->iob->eod) ? (CSP->iob->eod - CSP->iob->cur) : 0)
368 #define IOB_RESET(CSP) if(CSP->iob->buf) free(CSP->iob->buf); memset(CSP->iob, '\0', sizeof(CSP->iob));
369
370 /* Keys for csp->content_type */
371 #define CT_TEXT 0x01U
372 #define CT_GIF  0x02U
373
374 #define ACTION_MASK_ALL        (~0U)
375
376 #define ACTION_MOST_COMPATIBLE 0x0000U
377
378 #define ACTION_BLOCK           0x0001U
379 #define ACTION_DEANIMATE       0x2000U
380 #define ACTION_FAST_REDIRECTS  0x0002U
381 #define ACTION_FILTER          0x0004U
382 #define ACTION_HIDE_FORWARDED  0x0008U
383 #define ACTION_HIDE_FROM       0x0010U
384 #define ACTION_HIDE_REFERER    0x0020U /* sic - follow HTTP, not English */
385 #define ACTION_HIDE_USER_AGENT 0x0040U
386 #define ACTION_IMAGE           0x0080U
387 #define ACTION_IMAGE_BLOCKER   0x0100U
388 #define ACTION_NO_COOKIE_READ  0x0200U
389 #define ACTION_NO_COOKIE_SET   0x0400U
390 #define ACTION_NO_POPUPS       0x0800U
391 #define ACTION_VANILLA_WAFER   0x1000U
392
393 #define ACTION_STRING_DEANIMATE     0
394 #define ACTION_STRING_FROM          1
395 #define ACTION_STRING_IMAGE_BLOCKER 2
396 #define ACTION_STRING_REFERER       3
397 #define ACTION_STRING_USER_AGENT    4
398 #define ACTION_STRING_COUNT         5
399
400
401 #define ACTION_MULTI_ADD_HEADER     0
402 #define ACTION_MULTI_WAFER          1
403 #define ACTION_MULTI_COUNT          2
404
405 /*
406  * This structure contains a list of actions to apply to a URL.
407  * It only contains positive instructions - no "-" options.
408  * It is not used to store the actions list itself, only for
409  * url_actions() to return the current values.
410  */
411 struct current_action_spec
412 {
413    unsigned flags;    /* a bit set to "1" = add action    */
414
415    /* For those actions that require parameters: */
416
417    /* each entry is valid if & only if corresponding entry in "add" set. */
418    char * string[ACTION_STRING_COUNT];
419
420    /* Strings to add */
421    struct list multi[ACTION_MULTI_COUNT][1];
422 };
423
424
425 /*
426  * This structure contains a set of changes to actions.
427  * It can contain both positive and negative instructions.
428  * It is used to store an entry in the actions list.
429  */
430 struct action_spec
431 {
432    unsigned mask;   /* a bit set to "0" = remove action */
433    unsigned add;    /* a bit set to "1" = add action    */
434
435    /* For those actions that require parameters: */
436
437    /* each entry is valid if & only if corresponding entry in "add" set. */
438    char * string[ACTION_STRING_COUNT];
439
440    /* Strings to remove. */
441    struct list multi_remove[ACTION_MULTI_COUNT][1];
442
443    /* If nonzero, remove *all* strings. */
444    int         multi_remove_all[ACTION_MULTI_COUNT];
445
446    /* Strings to add */
447    struct list multi_add[ACTION_MULTI_COUNT][1];
448 };
449
450 /*
451  * This structure is used to store the actions list.
452  *
453  * It contains a URL pattern, and the chages to the actions.
454  * It is a linked list.
455  */
456 struct url_actions
457 {
458    struct url_spec url[1];
459
460    struct action_spec action[1];
461
462    struct url_actions * next;
463 };
464
465
466 /* Constants defining bitmask for csp->accept_types */
467
468 #ifdef DETECT_MSIE_IMAGES
469
470 /* MSIE detected by user-agent string */
471 #define ACCEPT_TYPE_IS_MSIE     0x0001
472
473 /*
474  * *If* this is MSIE, it wants an image.  (Or this is a shift-reload, or
475  * it's got an image from this URL before...  yuck!)
476  * Only meaningful if ACCEPT_TYPE_IS_MSIE set 
477  */
478 #define ACCEPT_TYPE_MSIE_IMAGE  0x0002
479
480 /*
481  * *If* this is MSIE, it wants a HTML document.
482  * Only meaningful if ACCEPT_TYPE_IS_MSIE set
483  */
484 #define ACCEPT_TYPE_MSIE_HTML   0x0004
485
486 #endif /* def DETECT_MSIE_IMAGES */
487
488
489 struct client_state
490 {
491    /* The proxy's configuration */
492    struct configuration_spec * config;
493
494    /* The actions to perform on the current request */
495    struct current_action_spec  action[1];
496
497    /* socket to talk to client (web browser) */
498    int  cfd;
499
500    /* socket to talk to server (web server or proxy) */
501    int  sfd;
502
503
504 #ifdef STATISTICS
505    /* 1 if this URL was rejected, 0 otherwise. Allows actual stats inc to 
506     * occur in main thread only for thread-safety. 
507     */
508    int  rejected;
509 #endif /* def STATISTICS */
510
511 #ifdef FORCE_LOAD
512    int force;
513 #endif /* def FORCE_LOAD */
514
515 #ifdef TOGGLE
516    int   toggled_on;
517 #endif /* def TOGGLE */
518
519    /*
520     * Client PC's IP address, as reported by the accept()_ function.
521     * Both as string and number
522     */
523    char *ip_addr_str;
524    long  ip_addr_long;
525
526
527    /* Our IP address and hostname, i.e. the IP address that
528       the client used to reach us, and the associated hostname,
529       both as strings
530     */
531    char *my_ip_addr_str;
532    char *my_hostname;
533
534 #ifdef TRUST_FILES
535    /* The referer in this request, if one was specified. */
536    char *referrer;
537 #endif /* def TRUST_FILES */
538
539 #if defined(DETECT_MSIE_IMAGES)
540    /* Types the client will accept.
541     * Bitmask - see ACCEPT_TYPE_XXX constants.
542     */
543    int accept_types;
544 #endif /* defined(DETECT_MSIE_IMAGES) */
545
546    /* The URL that was requested */
547    struct http_request http[1];
548
549    /* An I/O buffer used for buffering data read from the client */
550    struct iob iob[1];
551
552    /* List of all headers for this request */
553    struct list headers[1];
554
555    /* List of all cookies for this request */
556    struct list cookie_list[1];
557
558    /* MIME-Type bitmap, see CT_* above */
559    unsigned char content_type;
560
561    /* The "X-Forwarded-For:" header sent by the client */
562    char   *x_forwarded;
563
564    /*
565     * Nonzero if this client is processing data.
566     * Set to zero when the thread associated with this structure dies.
567     */
568    int active;
569
570    /* files associated with this client */
571    struct file_list *actions_list;
572
573    struct file_list *rlist;   /* pcrs job file */
574    size_t content_length;     /* Length after content modification */ 
575
576 #ifdef TRUST_FILES
577    struct file_list *tlist;   /* trustfile */
578 #endif /* def TRUST_FILES */
579
580    struct client_state *next;
581 };
582
583
584 struct parsers
585 {
586    char *str;
587    char  len;
588    char *(*parser)(const struct parsers *, char *, struct client_state *);
589 };
590
591 struct cgi_dispatcher
592 {
593    const char *name;
594    int         name_length;
595    int         (*handler)(struct client_state *csp, struct http_response *rsp, struct map *parameters);
596    const char *description;
597 };
598
599 struct file_list
600 {
601    /*
602     * this is a pointer to the data structures associated with the file.
603     * Read-only once the structure has been created.
604     */
605    void *f;
606    
607    /* Normally NULL.  When we are finished with file (i.e. when we have
608     * loaded a new one), set to a pointer to an unloader function.
609     * Unloader will be called by sweep() (called from main loop) when
610     * all clients using this file are done.  This prevents threading 
611     * problems.
612     */
613    void (*unloader)(void *);
614
615    /* Used internally by sweep().  Do not access from elsewhere. */
616    int active;
617
618 #ifndef SPLIT_PROXY_ARGS
619    /* String to be displayed as part of show-proxy-args display.
620     * Read-only once the structure has been created.
621     */
622    char *proxy_args;
623 #endif /* ndef SPLIT_PROXY_ARGS */
624
625    /* Following variables allow us to check if file has been changed.
626     * Read-only once the structure has been created.
627     */
628    time_t lastmodified;
629    char * filename;
630
631    /* Pointer to next entry in the linked list of all "file_list"s.
632     * This linked list is so that sweep() can navigate it.
633     * Since sweep() can remove items from the list, we must be careful
634     * to only access this value from main thread (when we know sweep
635     * won't be running).
636     */
637    struct file_list *next;
638 };
639
640
641 #ifdef TRUST_FILES
642 struct block_spec
643 {
644    struct url_spec url[1];
645    int    reject;
646    struct block_spec *next;
647 };
648 #endif /* def TRUST_FILES */
649
650
651 #define SOCKS_NONE    0    /* Don't use a SOCKS server */
652 #define SOCKS_4      40    /* original SOCKS 4 protocol */
653 #define SOCKS_4A     41    /* as modified for hosts w/o external DNS */
654
655 struct forward_spec
656 {
657    struct url_spec url[1];
658
659    /* Connection type - must be a SOCKS_xxx constant */
660    int   type;
661
662    /* SOCKS server */
663    char *gateway_host;
664    int   gateway_port;
665
666    /* Parent HTTP proxy */
667    char *forward_host;
668    int   forward_port;
669
670    /* For the linked list */
671    struct forward_spec *next;
672 };
673
674 struct re_filterfile_spec
675 {
676    char *username;
677    char *filtername;
678    struct list patterns[1];
679    pcrs_job *joblist;
680 };
681
682 #ifdef ACL_FILES
683 #define ACL_PERMIT   1  /* accept connection request */
684 #define ACL_DENY     2  /* reject connection request */
685
686 struct access_control_addr
687 {
688    unsigned long addr;
689    unsigned long mask;
690    unsigned long port;
691 };
692
693 struct access_control_list
694 {
695    struct access_control_addr src[1];
696    struct access_control_addr dst[1];
697
698    short action;
699    struct access_control_list *next;
700 };
701 #endif /* def ACL_FILES */
702
703
704 /* Maximum number of loaders (actions, re_filter, ...) */
705 #define NLOADERS 8
706
707 /*
708  * Data loaded from the configuration file.
709  *
710  * (Anomaly: toggle is still handled through a global, not this structure)
711  */
712 struct configuration_spec
713 {
714    int debug;
715    int multi_threaded;
716
717    const char *logfile;
718
719    const char *confdir;
720    const char *logdir;
721    const char *actions_file;
722
723    /* The administrator's email address */
724    char *admin_address;
725
726    /* A URL with info on this proxy */
727    char *proxy_info_url;
728
729    const char *re_filterfile;
730
731 #ifdef JAR_FILES
732    const char * jarfile;
733    FILE * jar;
734 #endif /* def JAR_FILES */
735
736    /*
737     * Port and IP to bind to.
738     * Defaults to HADDR_DEFAULT:HADDR_PORT == 127.0.0.1:8000
739     */
740    const char *haddr;
741    int         hport;
742
743 #ifndef SPLIT_PROXY_ARGS
744    const char *suppress_message;
745 #endif /* ndef SPLIT_PROXY_ARGS */
746
747 #ifndef SPLIT_PROXY_ARGS
748    /* suppress listing config files */
749    int suppress_blocklists;
750 #endif /* ndef SPLIT_PROXY_ARGS */
751
752 #ifdef TRUST_FILES
753    const char * trustfile;
754
755    struct list trust_info[1];
756    struct url_spec *trust_list[64];
757 #endif /* def TRUST_FILES */
758
759 #ifdef ACL_FILES
760    struct access_control_list *acl;
761 #endif /* def ACL_FILES */
762
763    struct forward_spec *forward;
764
765    /* All options from the config file, HTML-formatted */
766    char *proxy_args;
767
768    /* the configuration file object. */
769    struct file_list *config_file_list;
770
771    /* List of loaders */
772    int (*loaders[NLOADERS])(struct client_state *);
773
774    /* bool, nonzero if we need to bind() to the new port */
775    int need_bind;
776 };
777
778
779 #define SZ(X)  (sizeof(X) / sizeof(*X))
780
781 #ifdef FORCE_LOAD
782 #define FORCE_PREFIX "/IJB-FORCE-LOAD"
783 #endif /* def FORCE_LOAD */
784
785 /* Hardwired URLs */
786 #define HOME_PAGE_URL  "http://ijbswa.sourceforge.net"
787 #define REDIRECT_URL HOME_PAGE_URL "/redirect.php?v=" VERSION "&to="
788 #define CGI_PREFIX_HOST "i.j.b"
789
790 /* HTTP snipplets */
791 static const char CSUCCEED[] =
792    "HTTP/1.0 200 Connection established\n"
793    "Proxy-Agent: IJ/" VERSION "\n\n";
794
795 static const char CHEADER[] =
796    "HTTP/1.0 400 Invalid header received from browser\n\n";
797
798 #ifdef __cplusplus
799 } /* extern "C" */
800 #endif
801
802 #endif /* ndef _PROJECT_H */
803
804 /*
805   Local Variables:
806   tab-width: 3
807   end:
808 */