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

Contents of /hydra/src/defines.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (show annotations)
Mon Sep 23 19:28:41 2002 UTC (21 years, 6 months ago) by nmav
Branch: MAIN
CVS Tags: BOAS_WITH_RANGES_AND_CGI
Changes since 1.5: +3 -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) 1997 Jon Nelson <jnelson@boa.org>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 1, or (at your option)
9 * any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 *
20 */
21
22 /* $Id: defines.h,v 1.5 2002/09/23 17:56:41 nmav Exp $*/
23
24 #ifndef _DEFINES_H
25 #define _DEFINES_H
26
27 /***** Change this, or use -c on the command line to specify it *****/
28
29 #ifndef SERVER_ROOT
30 #define SERVER_ROOT "/etc/boa"
31 #endif
32
33 /***** Change this via the CGIPath configuration value in boa.conf *****/
34 #define DEFAULT_PATH "/bin:/usr/bin:/usr/local/bin"
35
36 /***** Change this via the SinglePostLimit configuration value in boa.conf *****/
37 #define SINGLE_POST_LIMIT_DEFAULT 1024 * 1024 /* 1 MB */
38
39 /***** BOA error codes for socket operations */
40 #define BOA_E_AGAIN -1
41 #define BOA_E_PIPE -2
42 #define BOA_E_INTR -3
43 #define BOA_E_UNKNOWN -255
44
45 /***** Various stuff that you may want to tweak, but probably shouldn't *****/
46
47 #define SOCKETBUF_SIZE 16*1024
48 #define MAX_HEADER_LENGTH 1024
49 #define CLIENT_STREAM_SIZE SOCKETBUF_SIZE
50 #define BUFFER_SIZE CLIENT_STREAM_SIZE
51
52 #define MIME_HASHTABLE_SIZE 47
53 #define ALIAS_HASHTABLE_SIZE 17
54 #define PASSWD_HASHTABLE_SIZE 47
55
56 #define REQUEST_TIMEOUT 60
57
58 #define CGI_MIME_TYPE "application/x-httpd-cgi"
59
60 /***** CHANGE ANYTHING BELOW THIS LINE AT YOUR OWN PERIL *****/
61 /***** You will probably introduce buffer overruns unless you know
62 what you are doing *****/
63
64 #define MAX_SITENAME_LENGTH 256
65 #define MAX_LOG_LENGTH MAX_HEADER_LENGTH + 1024
66 #define MAX_FILE_LENGTH NAME_MAX
67 #define MAX_PATH_LENGTH PATH_MAX
68
69 #ifdef ACCEPT_ON
70 #define MAX_ACCEPT_LENGTH MAX_HEADER_LENGTH
71 #else
72 #define MAX_ACCEPT_LENGTH 0
73 #endif
74
75 #define SERVER_VERSION BOA_VERSION
76
77 #define CGI_VERSION "CGI/1.1"
78 #define COMMON_CGI_COUNT 5
79 #define CGI_ENV_MAX 50
80 #define CGI_ARGC_MAX 128
81
82 /******************* RESPONSE CLASSES *****************/
83
84 #define R_INFORMATIONAL 1
85 #define R_SUCCESS 2
86 #define R_REDIRECTION 3
87 #define R_CLIENT_ERROR 4
88 #define R_SERVER_ERROR 5
89
90 /******************* RESPONSE CODES ******************/
91
92 #define R_REQUEST_OK 200
93 #define R_CREATED 201
94 #define R_ACCEPTED 202
95 #define R_PROVISIONAL 203 /* provisional information */
96 #define R_NO_CONTENT 204
97 #define R_REQUEST_PARTIAL 206
98
99 #define R_MULTIPLE 300 /* multiple choices */
100 #define R_MOVED_PERM 301
101 #define R_MOVED_TEMP 302
102 #define R_NOT_MODIFIED 304
103
104 #define R_BAD_REQUEST 400
105 #define R_UNAUTHORIZED 401
106 #define R_PAYMENT 402 /* payment required */
107 #define R_FORBIDDEN 403
108 #define R_NOT_FOUND 404
109 #define R_METHOD_NA 405 /* method not allowed */
110 #define R_NONE_ACC 406 /* none acceptable */
111 #define R_PROXY 407 /* proxy authentication required */
112 #define R_REQUEST_TO 408 /* request timeout */
113 #define R_CONFLICT 409
114 #define R_GONE 410
115 #define R_RANGE_UNSATISFIABLE 410
116
117 #define R_ERROR 500 /* internal server error */
118 #define R_NOT_IMP 501 /* not implemented */
119 #define R_BAD_GATEWAY 502
120 #define R_SERVICE_UNAV 503 /* service unavailable */
121 #define R_GATEWAY_TO 504 /* gateway timeout */
122 #define R_BAD_VERSION 505
123
124 /****************** METHODS *****************/
125
126 #define M_GET 1
127 #define M_HEAD 2
128 #define M_PUT 3
129 #define M_POST 4
130 #define M_DELETE 5
131 #define M_LINK 6
132 #define M_UNLINK 7
133
134 /************** REQUEST STATUS (req->status) ***************/
135
136 #define READ_HEADER 0
137 #define ONE_CR 1
138 #define ONE_LF 2
139 #define TWO_CR 3
140 #define BODY_READ 4
141 #define BODY_WRITE 5
142 #define WRITE 6
143 #define PIPE_READ 7
144 #define PIPE_WRITE 8
145 #define DONE 9
146 #define DEAD 10
147 #define FINISH_HANDSHAKE 11
148 #define SEND_ALERT 12
149
150 /************** CGI TYPE (req->is_cgi) ******************/
151
152 #define CGI 1
153 #define NPH 2
154 #define GUNZIP_CGI 3
155 #define INDEXER_CGI 4
156
157 /************* ALIAS TYPES (aliasp->type) ***************/
158
159 #define ALIAS 0
160 #define SCRIPTALIAS 1
161 #define REDIRECT 2
162
163 /*********** KEEPALIVE CONSTANTS (req->keepalive) *******/
164
165 #define KA_INACTIVE 0
166 #define KA_STOPPED 1
167 #define KA_ACTIVE 2
168
169 /********* CGI STATUS CONSTANTS (req->cgi_status) *******/
170 #define CGI_PARSE 1
171 #define CGI_BUFFER 2
172 #define CGI_DONE 3
173
174 /*********** MMAP_LIST CONSTANTS ************************/
175 #define USE_MMAP_LIST /* undefine it in constraint environments
176 * to save memory, from mmaped files.
177 */
178
179 #define MMAP_LIST_SIZE 256
180 #define MMAP_LIST_MASK 255
181 #define MMAP_LIST_NEXT(i) (((i)+1)&MMAP_LIST_MASK)
182 #define MMAP_LIST_HASH(dev,ino,size) ((ino)&MMAP_LIST_MASK)
183
184 #define MAX_FILE_MMAP 100 * 1024 /* 100K */
185
186 /***************** USEFUL MACROS ************************/
187
188 #define SQUASH_KA(req) (req->keepalive=KA_STOPPED)
189
190 #define BOA_FD_SET(fd, where) { FD_SET(fd, where); \
191 if (fd > params->max_fd) params->max_fd = fd; \
192 }
193
194 /* If and when everyone has a modern gcc or other near-C99 compiler,
195 * change these to static inline functions. Also note that since
196 * we never fuss with O_APPEND append or O_ASYNC, we shouldn't have
197 * to perform an extra system call to F_GETFL first.
198 */
199
200 #ifdef BOA_USE_GETFL
201 #define set_block_fd(fd) real_set_block_fd(fd)
202 #define set_nonblock_fd(fd) real_set_nonblock_fd(fd)
203 #else
204 #define set_block_fd(fd) fcntl(fd, F_SETFL, 0)
205 #define set_nonblock_fd(fd) fcntl(fd, F_SETFL, NOBLOCK)
206 #endif
207
208 #define DIE(mesg) log_error_mesg(__FILE__, __LINE__, mesg), exit(1)
209 #define WARN(mesg) log_error_mesg(__FILE__, __LINE__, mesg)
210
211 #endif

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26