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

Contents of /hydra/src/globals.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (show annotations)
Mon Sep 23 19:28:41 2002 UTC (21 years, 7 months ago) by nmav
Branch: MAIN
CVS Tags: BOAS_WITH_RANGES_AND_CGI
Changes since 1.4: +4 -1 lines
File MIME type: text/plain
Cleaned up the CGI handling. Now gunzip, indexer are treated like real cgis. Several other cleanups.

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.4 2002/09/23 12:48:59 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 struct alias {
48 char *fakename; /* URI path to file */
49 char *realname; /* Actual path to file */
50 int type; /* ALIAS, SCRIPTALIAS, REDIRECT */
51 int fake_len; /* strlen of fakename */
52 int real_len; /* strlen of realname */
53 struct alias *next;
54 };
55
56 typedef struct alias alias;
57
58 struct request { /* pending requests */
59 int fd; /* client's socket fd */
60 GNUTLS_STATE ssl_state;
61 int secure; /* whether ssl or not */
62 int alert_to_send; /* in SEND_ALERT state */
63
64 int status; /* see #defines.h */
65 time_t time_last; /* time of last succ. op. */
66 char *pathname; /* pathname of requested file */
67 size_t range_start; /* send file from byte ... */
68 size_t range_stop; /* to byte */
69 size_t pipe_range_stop; /* This is used only if the file is sent by the pipe_read() method.
70 * Indicates how many bytes to send from a file (actually a copy of range_stop,
71 * but it is modified. */
72 int simple; /* simple request? */
73 int keepalive; /* keepalive status */
74 int kacount; /* keepalive count */
75
76 int data_fd; /* fd of data */
77 unsigned long filesize; /* filesize */
78 unsigned long filepos; /* position in file */
79 char *data_mem; /* mmapped/malloced char array */
80 int method; /* M_GET, M_POST, etc. */
81
82 char *logline; /* line to log file */
83
84 char *header_line; /* beginning of un or incompletely processed header line */
85 char *header_end; /* last known end of header, or end of processed data */
86 int parse_pos; /* how much have we parsed */
87 int client_stream_pos; /* how much have we read... */
88
89 int buffer_start; /* where the buffer starts */
90 int buffer_end; /* where the buffer ends */
91
92 char *http_version; /* HTTP/?.? of req */
93 int response_status; /* R_NOT_FOUND etc. */
94
95 char *if_modified_since; /* If-Modified-Since */
96 time_t last_modified; /* Last-modified: */
97
98 char local_ip_addr[NI_MAXHOST]; /* for virtualhost */
99
100 /* CGI vars */
101
102 int remote_port; /* could be used for ident */
103
104 char remote_ip_addr[NI_MAXHOST]; /* after inet_ntoa */
105
106 int is_cgi; /* true if CGI/NPH */
107 int cgi_status;
108 int cgi_env_index; /* index into array */
109
110 /* Agent and referer for logfiles */
111 char *header_user_agent;
112 char *header_referer;
113
114 int post_data_fd; /* fd for post data tmpfile */
115
116 char *path_info; /* env variable */
117 char *path_translated; /* env variable */
118 char *script_name; /* env variable */
119 char *query_string; /* env variable */
120 char *content_type; /* env variable */
121 char *content_length; /* env variable */
122
123 struct mmap_entry *mmap_entry_var;
124
125 struct request *next; /* next */
126 struct request *prev; /* previous */
127
128 /* everything below this line is kept regardless */
129 char buffer[BUFFER_SIZE + 1]; /* generic I/O buffer */
130 char request_uri[MAX_HEADER_LENGTH + 1]; /* uri */
131 char client_stream[CLIENT_STREAM_SIZE]; /* data from client - fit or be hosed */
132 char *cgi_env[CGI_ENV_MAX + 4]; /* CGI environment */
133
134 #ifdef ACCEPT_ON
135 char accept[MAX_ACCEPT_LENGTH]; /* Accept: fields */
136 #endif
137 };
138
139 typedef struct request request;
140
141 struct status {
142 long requests;
143 long errors;
144 };
145
146
147 extern char *optarg; /* For getopt */
148 extern FILE *yyin; /* yacc input */
149
150 extern request **_request_ready; /* first in ready list */
151 extern request **_request_block; /* first in blocked list */
152 extern request **_request_free; /* first in free list */
153
154 typedef struct {
155 #ifdef ENABLE_SMP
156 pthread_t tid;
157 #endif
158 request* request_ready;
159 request* request_block;
160 request* request_free;
161 socket_type server_s[2];
162 fd_set block_read_fdset;
163 fd_set block_write_fdset;
164 struct timeval req_timeout;
165 int sighup_flag; /* 1 => signal has happened, needs attention */
166 int sigchld_flag; /* 1 => signal has happened, needs attention */
167 int sigalrm_flag; /* 1 => signal has happened, needs attention */
168 int sigusr1_flag; /* 1 => signal has happened, needs attention */
169 int sigterm_flag; /* lame duck mode */
170
171 int max_fd;
172
173 int sockbufsize;
174 struct status status;
175 int total_connections;
176
177 /* for SIGBUS handling */
178 jmp_buf env;
179 int handle_sigbus;
180
181 } server_params;
182
183 /* global server variables */
184
185 extern char *access_log_name;
186 extern char *error_log_name;
187 extern char *cgi_log_name;
188 extern int cgi_log_fd;
189 extern int use_localtime;
190
191 extern int boa_ssl;
192
193 extern int server_port;
194 extern int ssl_port;
195 extern uid_t server_uid;
196 extern gid_t server_gid;
197 extern char *server_admin;
198 extern char *server_root;
199 extern char *server_name;
200 extern char *server_ip;
201 extern int max_fd;
202 extern int devnullfd;
203
204 extern char *document_root;
205 extern char *user_dir;
206 extern char *directory_index;
207 extern char *default_type;
208 extern char *dirmaker;
209 extern char *mime_types;
210 extern char *cachedir;
211
212 extern char *tempdir;
213
214 extern char *cgi_path;
215 extern int single_post_limit;
216
217 extern int ka_timeout;
218 extern int ka_max;
219
220 extern int sighup_flag;
221 extern int sigchld_flag;
222 extern int sigalrm_flag;
223 extern int sigusr1_flag;
224 extern int sigterm_flag;
225 extern time_t start_time;
226
227 extern int pending_requests;
228 extern long int max_connections;
229
230 extern int verbose_cgi_logs;
231
232 extern int backlog;
233 extern time_t current_time;
234
235 extern int virtualhost;
236
237
238 #endif

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26