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