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