Makefile/in
[privoxy.git] / cgi.h
1 #ifndef _CGI_H
2 #define _CGI_H
3 #define CGI_H_VERSION "$Id: $"
4 /*********************************************************************
5  *
6  * File        :  $Source: /cvsroot/ijbswa/current/cgi.h,v $
7  *
8  * Purpose     :  Declares functions to intercept request, generate
9  *                html or gif answers, and to compose HTTP resonses.
10  *                
11  *                Functions declared include:
12  * 
13  *
14  * Copyright   :  Written by and Copyright (C) 2001 the SourceForge
15  *                IJBSWA team.  http://ijbswa.sourceforge.net
16  *
17  *                Based on the Internet Junkbuster originally written
18  *                by and Copyright (C) 1997 Anonymous Coders and 
19  *                Junkbusters Corporation.  http://www.junkbusters.com
20  *
21  *                This program is free software; you can redistribute it 
22  *                and/or modify it under the terms of the GNU General
23  *                Public License as published by the Free Software
24  *                Foundation; either version 2 of the License, or (at
25  *                your option) any later version.
26  *
27  *                This program is distributed in the hope that it will
28  *                be useful, but WITHOUT ANY WARRANTY; without even the
29  *                implied warranty of MERCHANTABILITY or FITNESS FOR A
30  *                PARTICULAR PURPOSE.  See the GNU General Public
31  *                License for more details.
32  *
33  *                The GNU General Public License should be included with
34  *                this file.  If not, you can view it at
35  *                http://www.gnu.org/copyleft/gpl.html
36  *                or write to the Free Software Foundation, Inc., 59
37  *                Temple Place - Suite 330, Boston, MA  02111-1307, USA.
38  *
39  * Revisions   :
40  *    $Log: cgi.h,v $
41  *
42  *
43  **********************************************************************/
44 \f
45
46 #include "project.h"
47
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
51
52 extern struct http_response *cgi_dispatch(struct client_state *csp);
53 extern int make_http_response(struct http_response *rsp);
54 extern void free_http_response(struct http_response *rsp);
55
56 extern struct map *parse_cgi(char *argstring);
57 char *dump_map(struct map *map);
58
59 extern int cgi_default(struct client_state *csp, struct http_response *rsp,
60                        struct map *parameters);
61 int cgi_show_status(struct client_state *csp, struct http_response *rsp,
62                     struct map *parameters);
63
64 extern char *ijb_show_url_info(struct http_request *http, struct client_state *csp);
65
66 extern char *redirect_url(struct http_request *http, struct client_state *csp);
67 extern int cgi_send_banner(struct client_state *csp, struct http_response *rsp,
68                            struct map *parameters);
69
70
71
72 #ifdef TRUST_FILES
73 extern char *ij_untrusted_url(struct http_request *http, struct client_state *csp);
74 #endif /* def TRUST_FILES */
75
76
77
78 #ifdef STATISTICS
79 extern char *add_stats(char *s);
80 #endif /* def STATISTICS */
81
82 static const char CJBGIF[] =
83    "GIF89aD\000\013\000\360\000\000\000\000\000\377\377\377!"
84    "\371\004\001\000\000\001\000,\000\000\000\000D\000\013\000"
85    "\000\002a\214\217\251\313\355\277\000\200G&K\025\316hC\037"
86    "\200\234\230Y\2309\235S\230\266\206\372J\253<\3131\253\271"
87    "\270\215\342\254\013\203\371\202\264\334P\207\332\020o\266"
88    "N\215I\332=\211\312\3513\266:\026AK)\364\370\365aobr\305"
89    "\372\003S\275\274k2\354\254z\347?\335\274x\306^9\374\276"
90    "\037Q\000\000;";
91
92 static const char CBLANKGIF[] =
93    "GIF89a\001\000\001\000\200\000\000\377\377\377\000\000"
94    "\000!\371\004\001\000\000\000\000,\000\000\000\000\001"
95    "\000\001\000\000\002\002D\001\000;";
96
97 static const char CBLOCK[] = 
98 #ifdef AMIGA 
99        "HTTP/1.0 403 Request for blocked URL\n" 
100 #else /* ifndef AMIGA */
101        "HTTP/1.0 202 Request for blocked URL\n"
102 #endif /* ndef AMIGA */
103        "Pragma: no-cache\n"
104        "Last-Modified: Thu Jul 31, 1997 07:42:22 pm GMT\n"
105        "Expires:       Thu Jul 31, 1997 07:42:22 pm GMT\n"
106        "Content-Type: text/html\n\n"
107        "<html>\n"
108        "<head>\n"
109        "<title>Internet Junkbuster: Request for blocked URL</title>\n"
110        "</head>\n"
111        WHITEBG
112        "<center><h1>"
113        BANNER
114        "</h1></center>\n"
115       "<p align=center>Your request for <b>%s%s</b>\n"
116       "was blocked.<br><a href=\"http://i.j.b/show-url-info?url=%s%s\">See why</a>"
117 #ifdef FORCE_LOAD
118        " or <a href=\"http://%s" FORCE_PREFIX "%s\">"
119        "go there anyway.</a>"
120 #endif /* def FORCE_LOAD */
121       "</p>\n"
122       "</body>\n"
123       "</html>\n";
124
125 #ifdef TRUST_FILES
126 static const char CTRUST[] =
127 #ifdef AMIGA 
128        "HTTP/1.0 403 Request for untrusted URL\n"
129 #else /* ifndef AMIGA */
130        "HTTP/1.0 202 Request for untrusted URL\n"
131 #endif /* ndef AMIGA */
132        "Pragma: no-cache\n"
133        "Last-Modified: Thu Jul 31, 1997 07:42:22 pm GMT\n"
134        "Expires:       Thu Jul 31, 1997 07:42:22 pm GMT\n"
135        "Content-Type: text/html\n\n"
136        "<html>\n"
137        "<head>\n"
138        "<title>Internet Junkbuster: Request for untrusted URL</title>\n"
139        "</head>\n"
140        WHITEBG
141        "<center>"
142        "<a href=http://i.j.b/ij-untrusted-url?%s+%s+%s>"
143        BANNER
144        "</a>"
145        "</center>"
146        "</body>\n"
147        "</html>\n";
148 #endif /* def TRUST_FILES */
149
150
151 static const char C_HOME_PAGE[] =
152    "<html>\n"
153    "<head>\n"
154    "<title>Internet Junkbuster: Information</title>\n"
155    "</head>\n"
156    BODY
157    "<h1><center>"
158    BANNER
159    "</h1></center>\n"
160    "<p><a href=\"" HOME_PAGE_URL "\">JunkBuster web site</a></p>\n"
161    "<p><a href=\"http://i.j.b/show-proxy-arg\">Proxy configuration</a></p>\n"
162    "<p><a href=\"http://i.j.b/show-url-info\">Look up a URL</a></p>\n"
163    "</body>\n"
164    "</html>\n";
165
166 static const char C_URL_INFO_HEADER[] =
167    "HTTP/1.0 200 OK\n"
168    "Pragma: no-cache\n"
169    "Expires:       Thu Jul 31, 1997 07:42:22 pm GMT\n"
170    "Content-Type: text/html\n\n"
171    "<html>\n"
172    "<head>\n"
173    "<title>Internet Junkbuster: URL Info</title>\n"
174    "</head>\n"
175    BODY
176    "<h1><center>"
177    BANNER
178    "</h1></center>\n"
179    "<p>Information for: <a href=\"http://%s\">http://%s</a></p>\n";
180 static const char C_URL_INFO_FOOTER[] =
181    "\n</p>\n"
182    "</body>\n"
183    "</html>\n";
184
185 static const char C_URL_INFO_FORM[] =
186    "HTTP/1.0 200 OK\n"
187    "Pragma: no-cache\n"
188    "Expires:       Thu Jul 31, 1997 07:42:22 pm GMT\n"
189    "Content-Type: text/html\n\n"
190    "<html>\n"
191    "<head>\n"
192    "<title>Internet Junkbuster: URL Info</title>\n"
193    "</head>\n"
194    BODY
195    "<h1><center>"
196    BANNER
197    "</h1></center>\n"
198    "<form method=\"GET\" action=\"http://i.j.b/show-url-info\">\n"
199    "<p>Please enter a URL, without the leading &quot;http://&quot;:</p>"
200    "<p><input type=\"text\" name=\"url\" size=\"80\">"
201    "<input type=\"submit\" value=\"Info\"></p>\n"
202    "</form>\n"
203    "</body>\n"
204    "</html>\n";
205
206 static const char CFAIL[] =
207    "HTTP/1.0 503 Connect failed\n"
208    "Content-Type: text/html\n\n"
209    "<html>\n"
210    "<head>\n"
211    "<title>Internet Junkbuster: Connect failed</title>\n"
212    "</head>\n"
213    BODY
214    "<h1><center>"
215    BANNER
216    "</center></h1>"
217    "TCP connection to '%s' failed: %s.\n<br>"
218    "</body>\n"
219    "</html>\n";
220
221 static const char CNXDOM[] =
222    "HTTP/1.0 404 Non-existent domain\n"
223    "Content-Type: text/html\n\n"
224    "<html>\n"
225    "<head>\n"
226    "<title>Internet Junkbuster: Non-existent domain</title>\n"
227    "</head>\n"
228    BODY
229    "<h1><center>"
230    BANNER
231    "</center></h1>"
232    "No such domain: %s\n"
233    "</body>\n"
234    "</html>\n";
235
236 static const char CNOBANNER[] =
237    "HTTP/1.0 200 No Banner\n"
238    "Content-Type: text/html\n\n"
239    "<html>\n"
240    "<head>\n"
241    "<title>Internet Junkbuster: No Banner</title>\n"
242    "</head>\n"
243    BODY
244    "<h1><center>"
245    BANNER
246    "</h1>"
247    "You asked for a banner that this proxy can't produce because either configuration does not permit.\n<br>"
248    "or the URL didn't end with .gif\n"
249    "</center></body>\n"
250    "</html>\n";
251
252
253 /* Revision control strings from this header and associated .c file */
254 extern const char cgi_rcs[];
255 extern const char cgi_h_rcs[];
256
257 #ifdef __cplusplus
258 } /* extern "C" */
259 #endif
260
261 #endif /* ndef _CGI_H */
262
263 /*
264   Local Variables:
265   tab-width: 3
266   end:
267 */