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