3 #define CGI_H_VERSION "$Id: cgi.h,v 1.3 2001/06/03 19:12:16 oes Exp $"
4 /*********************************************************************
6 * File : $Source: /cvsroot/ijbswa/current/cgi.h,v $
8 * Purpose : Declares functions to intercept request, generate
9 * html or gif answers, and to compose HTTP resonses.
11 * Functions declared include:
14 * Copyright : Written by and Copyright (C) 2001 the SourceForge
15 * IJBSWA team. http://ijbswa.sourceforge.net
17 * Based on the Internet Junkbuster originally written
18 * by and Copyright (C) 1997 Anonymous Coders and
19 * Junkbusters Corporation. http://www.junkbusters.com
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.
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.
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.
41 * Revision 1.3 2001/06/03 19:12:16 oes
42 * introduced new cgi handling
44 * Revision 1.1 2001/06/03 11:04:49 oes
51 * adapted to new enlist_unique arg format
55 * introduced confdir option
57 * filters.c filtrers.h
59 * extracted-CGI relevant stuff
67 * support for new cgi mechansim
71 * functions for new list type: "map"
72 * extended enlist_unique
79 * deleted const struct interceptors
87 * added struct http_response
88 * changes struct interceptors to struct cgi_dispatcher
89 * moved HTML stuff to cgi.h
100 **********************************************************************/
109 extern struct http_response *cgi_dispatch(struct client_state *csp);
110 extern int make_http_response(struct http_response *rsp);
111 extern void free_http_response(struct http_response *rsp);
113 extern struct map *parse_cgi(char *argstring);
114 extern char *dump_map(struct map *map);
116 extern int cgi_default(struct client_state *csp, struct http_response *rsp,
117 struct map *parameters);
118 extern int cgi_show_status(struct client_state *csp, struct http_response *rsp,
119 struct map *parameters);
121 extern int cgi_show_url_info(struct client_state *csp, struct http_response *rsp,
\r
122 struct map *parameters);
124 extern char *redirect_url(struct http_request *http, struct client_state *csp);
125 extern int cgi_send_banner(struct client_state *csp, struct http_response *rsp,
126 struct map *parameters);
131 extern char *ij_untrusted_url(struct http_request *http, struct client_state *csp);
132 #endif /* def TRUST_FILES */
137 extern char *add_stats(char *s);
138 #endif /* def STATISTICS */
140 static const char CJBGIF[] =
141 "GIF89aD\000\013\000\360\000\000\000\000\000\377\377\377!"
142 "\371\004\001\000\000\001\000,\000\000\000\000D\000\013\000"
143 "\000\002a\214\217\251\313\355\277\000\200G&K\025\316hC\037"
144 "\200\234\230Y\2309\235S\230\266\206\372J\253<\3131\253\271"
145 "\270\215\342\254\013\203\371\202\264\334P\207\332\020o\266"
146 "N\215I\332=\211\312\3513\266:\026AK)\364\370\365aobr\305"
147 "\372\003S\275\274k2\354\254z\347?\335\274x\306^9\374\276"
150 static const char CBLANKGIF[] =
151 "GIF89a\001\000\001\000\200\000\000\377\377\377\000\000"
152 "\000!\371\004\001\000\000\000\000,\000\000\000\000\001"
153 "\000\001\000\000\002\002D\001\000;";
155 static const char CBLOCK[] =
157 "HTTP/1.0 403 Request for blocked URL\n"
158 #else /* ifndef AMIGA */
159 "HTTP/1.0 202 Request for blocked URL\n"
160 #endif /* ndef AMIGA */
162 "Last-Modified: Thu Jul 31, 1997 07:42:22 pm GMT\n"
163 "Expires: Thu Jul 31, 1997 07:42:22 pm GMT\n"
164 "Content-Type: text/html\n\n"
167 "<title>Internet Junkbuster: Request for blocked URL</title>\n"
173 "<p align=center>Your request for <b>%s%s</b>\n"
174 "was blocked.<br><a href=\"http://i.j.b/show-url-info?url=%s%s\">See why</a>"
176 " or <a href=\"http://%s" FORCE_PREFIX "%s\">"
177 "go there anyway.</a>"
178 #endif /* def FORCE_LOAD */
184 static const char CTRUST[] =
186 "HTTP/1.0 403 Request for untrusted URL\n"
187 #else /* ifndef AMIGA */
188 "HTTP/1.0 202 Request for untrusted URL\n"
189 #endif /* ndef AMIGA */
191 "Last-Modified: Thu Jul 31, 1997 07:42:22 pm GMT\n"
192 "Expires: Thu Jul 31, 1997 07:42:22 pm GMT\n"
193 "Content-Type: text/html\n\n"
196 "<title>Internet Junkbuster: Request for untrusted URL</title>\n"
200 "<a href=http://i.j.b/ij-untrusted-url?%s+%s+%s>"
206 #endif /* def TRUST_FILES */
209 static const char C_HOME_PAGE[] =
212 "<title>Internet Junkbuster: Information</title>\n"
218 "<p><a href=\"" HOME_PAGE_URL "\">JunkBuster web site</a></p>\n"
219 "<p><a href=\"http://i.j.b/show-proxy-arg\">Proxy configuration</a></p>\n"
220 "<p><a href=\"http://i.j.b/show-url-info\">Look up a URL</a></p>\n"
224 static const char C_URL_INFO_HEADER[] =
227 "Expires: Thu Jul 31, 1997 07:42:22 pm GMT\n"
228 "Content-Type: text/html\n\n"
231 "<title>Internet Junkbuster: URL Info</title>\n"
237 "<p>Information for: <a href=\"http://%s\">http://%s</a></p>\n";
238 static const char C_URL_INFO_FOOTER[] =
243 static const char C_URL_INFO_FORM[] =
246 "Expires: Thu Jul 31, 1997 07:42:22 pm GMT\n"
247 "Content-Type: text/html\n\n"
250 "<title>Internet Junkbuster: URL Info</title>\n"
256 "<form method=\"GET\" action=\"http://i.j.b/show-url-info\">\n"
257 "<p>Please enter a URL, without the leading "http://":</p>"
258 "<p><input type=\"text\" name=\"url\" size=\"80\">"
259 "<input type=\"submit\" value=\"Info\"></p>\n"
264 static const char CFAIL[] =
265 "HTTP/1.0 503 Connect failed\n"
266 "Content-Type: text/html\n\n"
269 "<title>Internet Junkbuster: Connect failed</title>\n"
275 "TCP connection to '%s' failed: %s.\n<br>"
279 static const char CNXDOM[] =
280 "HTTP/1.0 404 Non-existent domain\n"
281 "Content-Type: text/html\n\n"
284 "<title>Internet Junkbuster: Non-existent domain</title>\n"
290 "No such domain: %s\n"
294 static const char CNOBANNER[] =
295 "HTTP/1.0 200 No Banner\n"
296 "Content-Type: text/html\n\n"
299 "<title>Internet Junkbuster: No Banner</title>\n"
305 "You asked for a banner that this proxy can't produce because either configuration does not permit.\n<br>"
306 "or the URL didn't end with .gif\n"
311 /* Revision control strings from this header and associated .c file */
312 extern const char cgi_rcs[];
313 extern const char cgi_h_rcs[];
319 #endif /* ndef _CGI_H */