Convert a couple of URLs to https://
[privoxy.git] / cgi.h
1 #ifndef CGI_H_INCLUDED
2 #define CGI_H_INCLUDED
3 #define CGI_H_VERSION "$Id: cgi.h,v 1.42 2012/11/09 10:47:42 fabiankeil Exp $"
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-2009 the
15  *                Privoxy team. http://www.privoxy.org/
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  **********************************************************************/
40
41
42 #include "project.h"
43
44 /*
45  * Main dispatch function
46  */
47 extern struct http_response *dispatch_cgi(struct client_state *csp);
48
49 /* Not exactly a CGI */
50 extern struct http_response *error_response(struct client_state *csp,
51                                             const char *templatename);
52
53 /*
54  * CGI support functions
55  */
56 extern struct http_response * alloc_http_response(void);
57 extern void free_http_response(struct http_response *rsp);
58
59 extern struct http_response *finish_http_response(struct client_state *csp,
60                                                   struct http_response *rsp);
61
62 extern struct map * default_exports(const struct client_state *csp, const char *caller);
63
64 extern jb_err map_block_killer (struct map *exports, const char *name);
65 extern jb_err map_block_keep   (struct map *exports, const char *name);
66 extern jb_err map_conditional  (struct map *exports, const char *name, int choose_first);
67
68 extern jb_err template_load(const struct client_state *csp, char ** template_ptr,
69                             const char *templatename, int recursive);
70 extern jb_err template_fill(char ** template_ptr, const struct map *exports);
71 extern jb_err template_fill_for_cgi(const struct client_state *csp,
72                                     const char *templatename,
73                                     struct map *exports,
74                                     struct http_response *rsp);
75
76 extern void cgi_init_error_messages(void);
77 extern struct http_response *cgi_error_memory(void);
78 extern jb_err cgi_redirect (struct http_response * rsp, const char *target);
79
80 extern jb_err cgi_error_no_template(const struct client_state *csp,
81                                     struct http_response *rsp,
82                                     const char *template_name);
83 extern jb_err cgi_error_bad_param(const struct client_state *csp,
84                                   struct http_response *rsp);
85 extern jb_err cgi_error_disabled(const struct client_state *csp,
86                                  struct http_response *rsp);
87 extern jb_err cgi_error_unknown(const struct client_state *csp,
88                          struct http_response *rsp,
89                          jb_err error_to_report);
90
91 extern jb_err get_number_param(struct client_state *csp,
92                                const struct map *parameters,
93                                char *name,
94                                unsigned *pvalue);
95 extern jb_err get_string_param(const struct map *parameters,
96                                const char *param_name,
97                                const char **pparam);
98 extern char   get_char_param(const struct map *parameters,
99                              const char *param_name);
100 #ifdef FEATURE_COMPRESSION
101 /*
102  * Minimum length which a buffer has to reach before
103  * we bother to (re-)compress it. Completely arbitrary.
104  */
105 extern const size_t LOWER_LENGTH_LIMIT_FOR_COMPRESSION;
106 extern char *compress_buffer(char *buffer, size_t *buffer_length, int compression_level);
107 #endif
108
109 /*
110  * Text generators
111  */
112 extern void get_http_time(int time_offset, char *buf, size_t buffer_size);
113 extern char *add_help_link(const char *item, struct configuration_spec *config);
114 extern char *make_menu(const char *self, const unsigned feature_flags);
115 extern char *dump_map(const struct map *the_map);
116
117 /*
118  * Ad replacement images
119  */
120 extern const char image_pattern_data[];
121 extern const size_t  image_pattern_length;
122 extern const char image_blank_data[];
123 extern const size_t  image_blank_length;
124
125 /* Revision control strings from this header and associated .c file */
126 extern const char cgi_rcs[];
127 extern const char cgi_h_rcs[];
128
129 #endif /* ndef CGI_H_INCLUDED */
130
131 /*
132   Local Variables:
133   tab-width: 3
134   end:
135 */