/[hydra]/hydra/src/globals.h
ViewVC logotype

Contents of /hydra/src/globals.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.13 - (show annotations)
Sat Sep 28 08:50:07 2002 UTC (21 years, 6 months ago) by nmav
Branch: MAIN
Changes since 1.12: +3 -3 lines
File MIME type: text/plain
Updated the way HICModule works. Now accepts a content-type instead of a file extension. I think it is much cleaner.

1 /*
2 * Boa, an http server
3 * Copyright (C) 1995 Paul Phillips <paulp@go2net.com>
4 * Some changes Copyright (C) 1996,97 Larry Doolittle <ldoolitt@jlab.org>
5 * Some changes Copyright (C) 1997 Jon Nelson <jnelson@boa.org>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 1, or (at your option)
10 * any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 *
21 */
22
23 /* $Id: globals.h,v 1.12 2002/09/27 23:40:29 nmav Exp $*/
24
25 #ifndef _GLOBALS_H
26 #define _GLOBALS_H
27
28 #include <gnutls/gnutls.h>
29
30 typedef struct {
31 int socket;
32 int secure; /* ssl or not. NOTE: 0 or 1. Nothing else. */
33 int port;
34 int pending_requests;
35 } socket_type;
36
37 struct mmap_entry {
38 dev_t dev;
39 ino_t ino;
40 char *mmap;
41 int use_count;
42 size_t len;
43 int available;
44 int times_used;
45 };
46
47 typedef struct {
48 hic_shutdown_func shutdown;
49 hic_init_func init;
50 hic_request_func request;
51 void *dl_handle;
52 char* sym_prefix; /* ie. "_php" */
53 char* content_type; /* ie. "application/x-httpd-php" */
54 int content_type_len;
55 } hic_module_st;
56
57 struct alias {
58 char *fakename; /* URI path to file */
59 char *realname; /* Actual path to file */
60 int type; /* ALIAS, SCRIPTALIAS, REDIRECT */
61 int fake_len; /* strlen of fakename */
62 int real_len; /* strlen of realname */
63 struct alias *next;
64 };
65
66 typedef struct alias alias;
67
68 typedef struct _virthost {
69 char *ip; /* This virthost will be visible in this IP */
70 char *host; /* The hostname of the virtual host */
71 char* document_root; /* The document root of this virtual host */
72 char* user_dir; /* The user dir of this virtual host */
73 int user_dir_len; /* strlen of user_dir */
74 int ip_len; /* strlen of IP */
75 int host_len; /* strlen of hostname */
76 int document_root_len; /* strlen of document root */
77 alias *alias_hashtable[ALIAS_HASHTABLE_SIZE]; /* aliases in this virthost */
78 struct _virthost *next;
79 } virthost;
80
81 struct request { /* pending requests */
82 int fd; /* client's socket fd */
83 GNUTLS_STATE ssl_state;
84 int secure; /* whether ssl or not */
85 int alert_to_send; /* in SEND_ALERT state */
86
87 int status; /* see #defines.h */
88 time_t time_last; /* time of last succ. op. */
89 char *pathname; /* pathname of requested file */
90 size_t range_start; /* send file from byte ... */
91 size_t range_stop; /* to byte */
92 size_t pipe_range_stop; /* This is used only if the file is sent by the pipe_read() method.
93 * Indicates how many bytes to send from a file (actually a copy of range_stop,
94 * but it is modified. */
95 int simple; /* simple request? */
96 int keepalive; /* keepalive status */
97 int kacount; /* keepalive count */
98
99 int data_fd; /* fd of data */
100 unsigned long filesize; /* filesize */
101 unsigned long filepos; /* position in file */
102 char *data_mem; /* mmapped/malloced char array */
103 int method; /* M_GET, M_POST, etc. */
104
105 char *logline; /* line to log file */
106
107 char *header_line; /* beginning of un or incompletely processed header line */
108 char *header_end; /* last known end of header, or end of processed data */
109 int parse_pos; /* how much have we parsed */
110 int client_stream_pos; /* how much have we read... */
111
112 int buffer_start; /* where the buffer starts */
113 int buffer_end; /* where the buffer ends */
114
115 char *http_version; /* HTTP/?.? of req */
116 int response_status; /* R_NOT_FOUND etc. */
117
118 char *if_modified_since; /* If-Modified-Since */
119 time_t last_modified; /* Last-modified: */
120
121 char local_ip_addr[NI_MAXHOST]; /* for virtualhost */
122 char *hostname;
123 char document_root[MAX_PATH_LENGTH + 1];
124 char user_dir[MAX_USER_DIR_LENGTH + 1];
125
126 /* CGI vars */
127
128 int remote_port; /* could be used for ident */
129
130 char remote_ip_addr[NI_MAXHOST]; /* after inet_ntoa */
131
132 int is_cgi; /* true if CGI/NPH */
133 int cgi_status;
134 int cgi_env_index; /* index into array */
135
136 /* Agent and referer for logfiles */
137 char *header_user_agent;
138 char *header_referer;
139
140 int post_data_fd; /* fd for post data tmpfile */
141
142 char *path_info; /* env variable */
143 char *path_translated; /* env variable */
144 char *script_name; /* env variable */
145 char *query_string; /* env variable */
146 char *content_type; /* env variable */
147 char *content_length; /* env variable */
148
149 struct mmap_entry *mmap_entry_var;
150
151 struct request *next; /* next */
152 struct request *prev; /* previous */
153
154 /* everything below this line is kept regardless */
155 char buffer[BUFFER_SIZE + 1]; /* generic I/O buffer */
156 char request_uri[MAX_HEADER_LENGTH + 1]; /* uri */
157 char client_stream[CLIENT_STREAM_SIZE]; /* data from client - fit or be hosed */
158 char *cgi_env[CGI_ENV_MAX + 4]; /* CGI environment */
159
160 #ifdef ACCEPT_ON
161 char accept[MAX_ACCEPT_LENGTH]; /* Accept: fields */
162 #endif
163 };
164
165 typedef struct request request;
166
167 struct status {
168 long requests;
169 long errors;
170 };
171
172
173 extern char *optarg; /* For getopt */
174 extern FILE *yyin; /* yacc input */
175
176 extern request **_request_ready; /* first in ready list */
177 extern request **_request_block; /* first in blocked list */
178 extern request **_request_free; /* first in free list */
179
180 typedef struct {
181 #ifdef ENABLE_SMP
182 pthread_t tid;
183 #endif
184 request* request_ready;
185 request* request_block;
186 request* request_free;
187 socket_type server_s[2];
188 fd_set block_read_fdset;
189 fd_set block_write_fdset;
190 struct timeval req_timeout;
191 int sighup_flag; /* 1 => signal has happened, needs attention */
192 int sigchld_flag; /* 1 => signal has happened, needs attention */
193 int sigalrm_flag; /* 1 => signal has happened, needs attention */
194 int sigusr1_flag; /* 1 => signal has happened, needs attention */
195 int sigterm_flag; /* lame duck mode */
196
197 int max_fd;
198
199 int sockbufsize;
200 struct status status;
201 int total_connections;
202
203 /* for SIGBUS handling */
204 jmp_buf env;
205 int handle_sigbus;
206
207 } server_params;
208
209 /* global server variables */
210
211 extern char *access_log_name;
212 extern char *error_log_name;
213 extern char *cgi_log_name;
214 extern int cgi_log_fd;
215 extern int use_localtime;
216
217 extern int max_files_cache;
218 extern int max_file_size_cache;
219
220 extern int boa_ssl;
221
222 extern int server_port;
223 extern int ssl_port;
224 extern uid_t server_uid;
225 extern gid_t server_gid;
226 extern char *server_admin;
227 extern char *server_root;
228 extern char *server_name;
229 extern char *server_ip;
230 extern int max_fd;
231 extern int devnullfd;
232
233 extern char *default_type;
234 extern char *default_charset;
235 extern char *dirmaker;
236 extern char *mime_types;
237 extern char *cachedir;
238
239 extern char *default_document_root;
240 extern int default_document_root_size;
241
242 extern char *tempdir;
243
244 extern char *cgi_path;
245 extern int single_post_limit;
246
247 extern int ka_timeout;
248 extern int ka_max;
249
250 extern int sighup_flag;
251 extern int sigchld_flag;
252 extern int sigalrm_flag;
253 extern int sigusr1_flag;
254 extern int sigterm_flag;
255 extern time_t start_time;
256
257 extern int pending_requests;
258 extern long int max_connections;
259
260 extern int verbose_cgi_logs;
261
262 extern int backlog;
263 extern time_t current_time;
264
265
266 #endif

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26