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