Wed, 02 Jan 2013 16:03:50 +0100
added access log
1 | 1 | /* |
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. | |
3 | * | |
4 | * Copyright 2008 Sun Microsystems, Inc. All rights reserved. | |
5 | * | |
6 | * THE BSD LICENSE | |
7 | * | |
8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions are met: | |
10 | * | |
11 | * Redistributions of source code must retain the above copyright notice, this | |
12 | * list of conditions and the following disclaimer. | |
13 | * Redistributions in binary form must reproduce the above copyright notice, | |
14 | * this list of conditions and the following disclaimer in the documentation | |
15 | * and/or other materials provided with the distribution. | |
16 | * | |
17 | * Neither the name of the nor the names of its contributors may be | |
18 | * used to endorse or promote products derived from this software without | |
19 | * specific prior written permission. | |
20 | * | |
21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
24 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER | |
25 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
26 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
27 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
28 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
30 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
31 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
32 | */ | |
33 | ||
34 | #ifndef PUBLIC_NSAPI_H | |
35 | #define PUBLIC_NSAPI_H | |
36 | ||
37 | /* | |
38 | * File: nsapi.h | |
39 | * | |
40 | * Description: | |
41 | * | |
42 | * This file defines an interface for extending the server with | |
43 | * in-process plug-ins. | |
44 | */ | |
45 | ||
46 | #ifdef __cplusplus | |
47 | extern "C" { | |
48 | #endif | |
49 | ||
50 | /* NSAPI version defined by this header file */ | |
51 | #define NSAPI_VERSION 303 | |
52 | ||
53 | /* Define USE_NSAPI_VERSION to use a specific NSAPI version at compile time */ | |
54 | #ifdef USE_NSAPI_VERSION | |
55 | #if USE_NSAPI_VERSION < 300 || USE_NSAPI_VERSION > NSAPI_VERSION | |
56 | #error This header file does not support the requested NSAPI version | |
57 | #else | |
58 | #undef NSAPI_VERSION | |
59 | #define NSAPI_VERSION USE_NSAPI_VERSION | |
60 | #endif | |
61 | #endif | |
62 | ||
63 | /* --- Begin native platform configuration definitions --- */ | |
64 | ||
65 | #if !defined(XP_WIN32) && !defined(XP_UNIX) | |
66 | #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) | |
67 | #define XP_WIN32 | |
68 | #else | |
69 | #define XP_UNIX | |
70 | #endif | |
71 | #endif | |
72 | ||
73 | #ifdef XP_UNIX | |
74 | #define NSAPI_PUBLIC | |
75 | #define ZERO(ptr, len) memset(ptr, 0, len) | |
76 | #ifdef AIX | |
77 | #define TCPLEN_T size_t | |
78 | #endif | |
79 | #ifdef HPUX | |
80 | #define TCPLEN_T int | |
81 | #endif | |
82 | #ifndef TCPLEN_T | |
83 | #define TCPLEN_T socklen_t | |
84 | #endif | |
85 | #endif /* XP_UNIX */ | |
86 | ||
87 | #ifdef XP_WIN32 | |
88 | #define NSAPI_PUBLIC __declspec(dllexport) | |
89 | struct iovec { | |
90 | char *iov_base; | |
91 | unsigned iov_len; | |
92 | }; | |
93 | #ifndef S_ISDIR | |
94 | #define S_ISDIR(mode) ((mode & S_IFMT) == S_IFDIR) | |
95 | #endif | |
96 | #ifndef S_ISREG | |
97 | #define S_ISREG(mode) ((mode & S_IFMT) == S_IFREG) | |
98 | #endif | |
99 | #ifndef S_ISLNK | |
100 | #define S_ISLNK(x) (0) | |
101 | #endif | |
102 | #define caddr_t PCHAR | |
103 | #define NEED_STRCASECMP | |
104 | #define NEED_STRNCASECMP | |
105 | #define ZERO(ptr, len) ZeroMemory(ptr, len) | |
106 | #define TCPLEN_T int | |
107 | #endif /* XP_WIN32 */ | |
108 | ||
109 | /* --- End native platform configuration definitions --- */ | |
110 | ||
111 | /* --- Begin miscellaneous definitions --- */ | |
112 | ||
113 | /* Used in some places as a length limit on error messages */ | |
114 | #define MAGNUS_ERROR_LEN 1024 | |
115 | ||
116 | /* Carriage return and line feed */ | |
117 | #define CR 13 | |
118 | #define LF 10 | |
119 | #ifdef XP_WIN32 | |
120 | #define ENDLINE "\r\n" | |
121 | #else | |
122 | #define ENDLINE "\n" | |
123 | #endif | |
124 | ||
125 | /* mime.types file identification line */ | |
126 | #define NCC_MT_MAGIC "#--Netscape Communications Corporation MIME Information" | |
127 | #define NCC_MT_MAGIC_LEN 55 | |
128 | ||
129 | /* The character which separates extensions with cinfo_find */ | |
130 | #define CINFO_SEPARATOR '.' | |
131 | ||
132 | /* The maximum length of a line in a mime.types file */ | |
133 | #define CINFO_MAX_LEN 1024 | |
134 | ||
135 | /* The maximum length of an error message */ | |
136 | #define MAX_ERROR_LEN 4096 | |
137 | ||
138 | /* | |
139 | * A warning is a minor mishap, such as a 404 being issued. | |
140 | */ | |
141 | #define LOG_WARN 0 | |
142 | ||
143 | /* | |
144 | * A misconfig is when there is a syntax error or permission violation in | |
145 | * a config file. | |
146 | */ | |
147 | #define LOG_MISCONFIG 1 | |
148 | ||
149 | /* | |
150 | * Security warnings are issued when authentication fails, or a host is | |
151 | * given a 403 return code. | |
152 | */ | |
153 | #define LOG_SECURITY 2 | |
154 | ||
155 | /* | |
156 | * A failure is when a request could not be fulfilled due to an internal | |
157 | * problem, such as a CGI script exiting prematurely, or a filesystem | |
158 | * permissions problem. | |
159 | */ | |
160 | #define LOG_FAILURE 3 | |
161 | ||
162 | /* | |
163 | * A catastrophe is a fatal server error such as running out of | |
164 | * memory or processes, or a system call failing, or even a server crash. | |
165 | * The server child cannot recover from a catastrophe. | |
166 | */ | |
167 | #define LOG_CATASTROPHE 4 | |
168 | ||
169 | /* | |
170 | * Informational message, of no concern. | |
171 | */ | |
172 | #define LOG_INFORM 5 | |
173 | ||
174 | /* | |
175 | * Internal diagnostic message. | |
176 | */ | |
177 | #define LOG_VERBOSE 6 | |
178 | ||
179 | /* | |
180 | * The time format to use in the error log | |
181 | */ | |
182 | #define ERR_TIMEFMT "[%d/%b/%Y:%H:%M:%S]" | |
183 | ||
184 | ||
185 | /* The fd you will get if you are reporting errors to SYSLOG */ | |
186 | #define ERRORS_TO_SYSLOG NULL | |
187 | ||
188 | /* Return codes from file I/O routines */ | |
189 | #define IO_OKAY 1 | |
190 | #define IO_ERROR -1 | |
191 | #define IO_EOF 0 | |
192 | #define NETBUF_EOF -1 | |
193 | #define NETBUF_ERROR -2 | |
194 | #define NETBUF_FULL -3 | |
195 | ||
196 | /* The disk page size on this machine. */ | |
197 | #define FILE_BUFFERSIZE 4096 | |
198 | ||
199 | #ifdef XP_UNIX | |
200 | ||
201 | #define FILE_PATHSEP '/' | |
202 | #define FILE_PARENT "../" | |
203 | ||
204 | #elif defined(XP_WIN32) | |
205 | ||
206 | #define FILE_PATHSEP '/' | |
207 | #define FILE_PARENT "..\\" | |
208 | ||
209 | #endif /* XP_WIN32 */ | |
210 | ||
211 | #define NET_INFINITE_TIMEOUT 0 | |
212 | #define NET_ZERO_TIMEOUT -1 | |
213 | ||
214 | #ifdef USE_REGEX | |
215 | /* WILDPAT uses regular expressions */ | |
216 | #define WILDPAT_VALID(exp) regexp_valid(exp) | |
217 | #define WILDPAT_MATCH(str, exp) regexp_match(str, exp) | |
218 | #define WILDPAT_CMP(str, exp) regexp_cmp(str, exp) | |
219 | #define WILDPAT_CASECMP(str, exp) regexp_casecmp(str, exp) | |
220 | #define WILDPAT_USES_REGEXP 1 | |
221 | #else | |
222 | /* WILDPAT uses shell expressions */ | |
223 | #define WILDPAT_VALID(exp) shexp_valid(exp) | |
224 | #define WILDPAT_MATCH(str, exp) shexp_match(str, exp) | |
225 | #define WILDPAT_CMP(str, exp) shexp_cmp(str, exp) | |
226 | #define WILDPAT_CASECMP(str, exp) shexp_casecmp(str, exp) | |
227 | #define WILDPAT_USES_SHEXP 1 | |
228 | #endif | |
229 | ||
230 | /* Define return codes from WILDPAT_VALID */ | |
231 | #define NON_WILDPAT -1 /* exp is ordinary string */ | |
232 | #define INVALID_WILDPAT -2 /* exp is an invalid pattern */ | |
233 | #define VALID_WILDPAT 1 /* exp is a valid pattern */ | |
234 | ||
235 | /* Define return codes from regexp_valid and shexp_valid */ | |
236 | #define NON_SXP NON_WILDPAT /* exp is an ordinary string */ | |
237 | #define INVALID_SXP INVALID_WILDPAT /* exp is an invalid shell exp */ | |
238 | #define VALID_SXP VALID_WILDPAT /* exp is a valid shell exp */ | |
239 | ||
240 | #define NON_REGEXP NON_SXP | |
241 | #define INVALID_REGEXP INVALID_SXP | |
242 | #define VALID_REGEXP VALID_SXP | |
243 | ||
244 | #define SYSTHREAD_DEFAULT_PRIORITY 16 | |
245 | ||
246 | /* The longest line in the configuration file */ | |
247 | #define CONF_MAXLEN 16384 | |
248 | ||
249 | #define HTTP_DATE_LEN 30 | |
250 | #define HTTP_DATE_FMT "%a, %d %b %Y %T GMT" | |
251 | ||
252 | /* HTTP status codes */ | |
253 | #define PROTOCOL_CONTINUE 100 | |
254 | #define PROTOCOL_SWITCHING 101 | |
255 | #define PROTOCOL_OK 200 | |
256 | #define PROTOCOL_CREATED 201 | |
257 | #define PROTOCOL_ACCEPTED 202 | |
258 | #define PROTOCOL_NONAUTHORITATIVE 203 | |
259 | #define PROTOCOL_NO_RESPONSE 204 | |
260 | #define PROTOCOL_NO_CONTENT 204 | |
261 | #define PROTOCOL_RESET_CONTENT 205 | |
262 | #define PROTOCOL_PARTIAL_CONTENT 206 | |
263 | #define PROTOCOL_MULTI_STATUS 207 | |
264 | #define PROTOCOL_MULTIPLE_CHOICES 300 | |
265 | #define PROTOCOL_MOVED_PERMANENTLY 301 | |
266 | #define PROTOCOL_REDIRECT 302 | |
267 | #define PROTOCOL_SEE_OTHER 303 | |
268 | #define PROTOCOL_NOT_MODIFIED 304 | |
269 | #define PROTOCOL_USE_PROXY 305 | |
270 | #define PROTOCOL_TEMPORARY_REDIRECT 307 | |
271 | #define PROTOCOL_BAD_REQUEST 400 | |
272 | #define PROTOCOL_UNAUTHORIZED 401 | |
273 | #define PROTOCOL_PAYMENT_REQUIRED 402 | |
274 | #define PROTOCOL_FORBIDDEN 403 | |
275 | #define PROTOCOL_NOT_FOUND 404 | |
276 | #define PROTOCOL_METHOD_NOT_ALLOWED 405 | |
277 | #define PROTOCOL_NOT_ACCEPTABLE 406 | |
278 | #define PROTOCOL_PROXY_UNAUTHORIZED 407 | |
279 | #define PROTOCOL_REQUEST_TIMEOUT 408 | |
280 | #define PROTOCOL_CONFLICT 409 | |
281 | #define PROTOCOL_GONE 410 | |
282 | #define PROTOCOL_LENGTH_REQUIRED 411 | |
283 | #define PROTOCOL_PRECONDITION_FAIL 412 | |
284 | #define PROTOCOL_ENTITY_TOO_LARGE 413 | |
285 | #define PROTOCOL_URI_TOO_LARGE 414 | |
286 | #define PROTOCOL_UNSUPPORTED_MEDIA_TYPE 415 | |
287 | #define PROTOCOL_REQUESTED_RANGE_NOT_SATISFIABLE 416 | |
288 | #define PROTOCOL_EXPECTATION_FAILED 417 | |
289 | #define PROTOCOL_LOCKED 423 | |
290 | #define PROTOCOL_FAILED_DEPENDENCY 424 | |
291 | #define PROTOCOL_SERVER_ERROR 500 | |
292 | #define PROTOCOL_NOT_IMPLEMENTED 501 | |
293 | #define PROTOCOL_BAD_GATEWAY 502 | |
294 | #define PROTOCOL_SERVICE_UNAVAILABLE 503 | |
295 | #define PROTOCOL_GATEWAY_TIMEOUT 504 | |
296 | #define PROTOCOL_VERSION_NOT_SUPPORTED 505 | |
297 | #define PROTOCOL_INSUFFICIENT_STORAGE 507 | |
298 | ||
299 | #define PROTOCOL_VERSION_HTTP09 9 | |
300 | #define PROTOCOL_VERSION_HTTP10 100 | |
301 | #define PROTOCOL_VERSION_HTTP11 101 | |
302 | #define CURRENT_PROTOCOL_VERSION PROTOCOL_VERSION_HTTP11 | |
303 | ||
304 | /* Definitions for HTTP over SSL */ | |
305 | #define HTTPS_PORT 443 | |
306 | #define HTTPS_URL "https" | |
307 | ||
308 | /* Definitions for HTTP over TCP */ | |
309 | #define HTTP_PORT 80 | |
310 | #define HTTP_URL "http" | |
311 | ||
312 | ||
313 | #define REQ_MAX_LINE 4096 | |
314 | ||
315 | /* | |
316 | * The REQ_ return codes. These codes are used to determine what the server | |
317 | * should do after a particular module completes its task. | |
318 | * | |
319 | * Func type functions return these as do many internal functions. | |
320 | */ | |
321 | ||
322 | /* The function performed its task, proceed with the request */ | |
323 | #define REQ_PROCEED 0 | |
324 | /* The entire request should be aborted: An error occurred */ | |
325 | #define REQ_ABORTED -1 | |
326 | /* The function performed no task, but proceed anyway */ | |
327 | #define REQ_NOACTION -2 | |
328 | /* Tear down the session and exit */ | |
329 | #define REQ_EXIT -3 | |
330 | /* Restart the entire request-response process */ | |
331 | #define REQ_RESTART -4 | |
332 | /* Too busy to execute this now */ | |
333 | #define REQ_TOOBUSY -5 | |
334 | ||
3
137197831306
minimal request handling
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
335 | |
137197831306
minimal request handling
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
336 | /**** NSAPI extensions ****/ |
137197831306
minimal request handling
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
337 | |
137197831306
minimal request handling
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
338 | /* The function is still in progress (async extension) */ |
137197831306
minimal request handling
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
339 | #define REQ_PROCESSING -8 |
137197831306
minimal request handling
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
340 | |
137197831306
minimal request handling
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
341 | /**** END NSAPI extensions ****/ |
137197831306
minimal request handling
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
342 | |
6
ce8fecc9847d
improved request processing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
3
diff
changeset
|
343 | |
1 | 344 | /* --- End miscellaneous definitions --- */ |
345 | ||
346 | /* --- Begin native platform includes --- */ | |
347 | ||
348 | #ifdef XP_UNIX | |
349 | #include <unistd.h> | |
350 | #include <sys/file.h> | |
6
ce8fecc9847d
improved request processing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
3
diff
changeset
|
351 | #include <alloca.h> /* new */ |
29
e8619defde14
added event handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
23
diff
changeset
|
352 | #include <pthread.h> |
1 | 353 | #ifndef HPUX |
354 | #include <sys/select.h> | |
355 | #endif | |
356 | #include <sys/socket.h> | |
357 | #include <sys/time.h> | |
358 | #include <sys/types.h> | |
359 | #include <sys/uio.h> | |
360 | #include <fcntl.h> | |
361 | #include <dirent.h> | |
362 | #include <pwd.h> | |
363 | #include <netinet/in.h> | |
364 | #endif /* XP_UNIX */ | |
365 | ||
366 | #ifdef XP_WIN32 | |
367 | #include <wtypes.h> | |
368 | #include <winbase.h> | |
369 | #include <direct.h> | |
370 | #include <winsock.h> | |
371 | #endif /* XP_WIN32 */ | |
372 | ||
373 | #include <sys/stat.h> | |
374 | #include <ctype.h> | |
375 | #include <stdio.h> | |
376 | #include <stdarg.h> | |
377 | #include <stdlib.h> | |
378 | #include <string.h> | |
379 | #include <errno.h> | |
380 | #include <time.h> | |
381 | ||
382 | /* --- End native platform includes --- */ | |
383 | ||
384 | /* --- Begin type definitions --- */ | |
385 | ||
386 | /* NOTE: both SYS_FILE and SYS_NETFD are actually NSPR PRFileDesc * and can */ | |
387 | /* be used with NSPR API calls (after casting them to PRFileDesc *) */ | |
388 | ||
389 | #ifndef SYS_FILE_T | |
390 | typedef void *SYS_FILE; | |
391 | #define SYS_FILE_T void * | |
392 | #endif /* !SYS_FILE_T */ | |
393 | ||
394 | #define SYS_ERROR_FD ((SYS_FILE)-1) | |
395 | ||
396 | #ifndef SYS_NETFD_T | |
397 | typedef void *SYS_NETFD; | |
398 | #define SYS_NETFD_T void * | |
399 | #endif /* !SYS_NETFD_T */ | |
400 | ||
401 | /* Error value for a SYS_NETFD */ | |
402 | #ifndef SYS_NET_ERRORFD | |
403 | #define SYS_NET_ERRORFD ((SYS_NETFD)-1) | |
404 | #endif /* !SYS_NET_ERRORFD */ | |
405 | ||
406 | /* | |
407 | * These structures were originally defined in nsapi.h, but those definitions | |
408 | * were removed in iPlanet Web Server 4.0. The contents of these structures | |
409 | * are now private to the server implementation and must not be accessed | |
410 | * directly. Instead, use the objset_*, object_*, directive_table_*, and | |
411 | * directive_* accessor functions. | |
412 | */ | |
413 | typedef struct directive directive; | |
414 | typedef struct dtable dtable; | |
415 | typedef struct httpd_object httpd_object; | |
416 | typedef struct httpd_objset httpd_objset; | |
417 | ||
418 | /* | |
419 | * Type: filebuffer, filebuf_t | |
420 | * | |
421 | * Description: | |
422 | * | |
423 | * This structure is used to represent a buffered file. On some | |
424 | * systems the file may be memory-mapped. A filebuffer is created | |
425 | * by filebuf_open(), and destroyed by filebuf_close(). | |
426 | * | |
427 | * Notes: | |
428 | * | |
429 | * Direct access to the members of this structure, not using | |
430 | * macros defined here, is discouraged. | |
431 | * | |
432 | * The filebuf alias that used to be defined for this type was | |
433 | * found to conflict with a C++ class of the same name, so it | |
434 | * has been renamed to filebuf_t. | |
435 | */ | |
436 | typedef struct filebuffer filebuffer; | |
437 | ||
438 | /* Version of filebuffer when memory-mapped files are supported */ | |
439 | struct filebuffer { | |
440 | SYS_FILE fd; | |
441 | #ifdef XP_WIN32 | |
442 | HANDLE fdmap; | |
443 | #endif | |
444 | caddr_t fp; | |
445 | int len; | |
446 | ||
447 | unsigned char *inbuf; | |
448 | int cursize; | |
449 | ||
450 | int pos; | |
451 | const char *errmsg; | |
452 | }; | |
453 | ||
454 | /* Return next character or IO_EOF */ | |
455 | #define filebuf_getc(b) ((b)->pos == (b)->len ? IO_EOF : (int)((b)->fp)[(b)->pos++]) | |
456 | ||
457 | #define filebuf_iseof(b) ((b)->pos == (b)->len) | |
458 | ||
459 | /* C++ streamio defines a filebuf class. */ | |
460 | typedef filebuffer filebuf_t; | |
461 | ||
462 | #ifdef XP_WIN32 | |
463 | /* Use a filebuffer to read data from a pipe */ | |
464 | #define pipebuf_getc(b) \ | |
465 | ((b)->pos != (b)->cursize ? (int)((b)->inbuf[(b)->pos++]) : pipebuf_next(b,1)) | |
466 | #endif /* XP_WIN32 */ | |
467 | ||
468 | /* | |
469 | * Type: netbuf | |
470 | * | |
471 | * Description: | |
472 | * | |
473 | * This structure is used to represent a buffered network socket. | |
474 | * It is created by netbuf_open(), and destroyed by netbuf_close(). | |
475 | * | |
476 | * Notes: | |
477 | * | |
478 | * Direct access to the members of this structure, not using | |
479 | * macros defined here, is discouraged. | |
480 | * | |
481 | * The inbuf field used to be (unsigned char *), but is now | |
482 | * simply (char *). The value returned by the netbuf_getc() | |
483 | * macro is (int). | |
484 | */ | |
485 | typedef struct netbuf netbuf; | |
486 | struct netbuf { | |
487 | SYS_NETFD sd; | |
488 | ||
489 | int pos, cursize, maxsize, rdtimeout; | |
490 | #ifdef XP_WIN32 | |
491 | CHAR address[64]; | |
492 | #endif /* XP_WIN32 */ | |
493 | unsigned char *inbuf; | |
494 | char *errmsg; | |
495 | #ifndef XP_WIN32 | |
496 | char address[64]; | |
497 | #endif /* !XP_WIN32 */ | |
498 | }; | |
499 | ||
500 | /* | |
501 | * netbuf_getc gets a character from the given network buffer and returns | |
502 | * it (as an integer). | |
503 | * | |
504 | * It will return (int) IO_ERROR for an error and (int) IO_EOF for | |
505 | * an error condition or EOF respectively. | |
506 | */ | |
507 | #define netbuf_getc(b) \ | |
508 | ((b)->pos != (b)->cursize ? (int)((b)->inbuf[(b)->pos++]) : netbuf_next(b,1)) | |
509 | ||
510 | /* | |
511 | * buffer_error returns the last error that occurred with buffer. Don't use | |
512 | * this unless you know an error occurred. Independent of network/file type. | |
513 | */ | |
514 | #define buffer_error(b) ((b)->errmsg) | |
515 | ||
516 | /* | |
517 | * Type: sendfiledata | |
518 | * | |
519 | * Description: | |
520 | * | |
521 | * This structure is used to pass arguments to the net_sendfile() | |
522 | * function. offset and len may be set to 0 to transmit a file in its | |
523 | * entirety. | |
524 | */ | |
525 | typedef struct sendfiledata sendfiledata; | |
526 | struct sendfiledata { | |
527 | SYS_FILE fd; /* file to send */ | |
528 | size_t offset; /* offset in file to start sending from */ | |
529 | size_t len; /* number of bytes to send from file */ | |
530 | const void *header; /* data to send before file */ | |
531 | int hlen; /* number of bytes to send before file */ | |
532 | const void *trailer; /* data to send after file */ | |
533 | int tlen; /* number of bytes to send after file */ | |
534 | }; | |
535 | ||
536 | /* | |
537 | * Type: NSAPIIOVec | |
538 | * | |
539 | * Description: | |
540 | * | |
541 | * This structure is used to pass arguments to the net_writev() | |
542 | * and FilterWritevFunc() functions. | |
543 | */ | |
544 | #ifdef _LP64 | |
545 | typedef struct NSAPIIOVec NSAPIIOVec; | |
546 | struct NSAPIIOVec { | |
547 | char *iov_base; | |
548 | int iov_len; | |
549 | }; | |
550 | #else | |
551 | typedef struct iovec NSAPIIOVec; | |
552 | #endif /* _LP64 */ | |
553 | ||
554 | ||
555 | /* | |
556 | * Type: cinfo | |
557 | * | |
558 | * Description: | |
559 | * | |
560 | * This is a structure that captures the information in the name/value | |
561 | * pairs on one line of a mime.types file. A cinfo structure is | |
562 | * stored in the memory-resident database, indexed by each of the | |
563 | * file extensions specified in the "exts" name/value pair. It | |
564 | * defines various attributes of resources with names containing | |
565 | * the specified file extensions. | |
566 | * | |
567 | * Notes: | |
568 | * | |
569 | * Pointers to cinfo structures returned by this API may or may not | |
570 | * need to freed by the caller. See the individual function | |
571 | * descriptions. | |
572 | * | |
573 | * The strings referenced by the fields of cinfo structures returned | |
574 | * by this API should be considered read-only, and do not need to be | |
575 | * freed by the caller, even when the cinfo structure does. | |
576 | */ | |
577 | typedef struct cinfo cinfo; | |
578 | struct cinfo { | |
579 | char *type; | |
580 | char *encoding; | |
581 | char *language; | |
582 | }; | |
583 | ||
584 | ||
585 | typedef void* CONDVAR; | |
586 | typedef void *COUNTING_SEMAPHORE; | |
587 | typedef void* CRITICAL; | |
588 | ||
589 | #ifdef XP_UNIX | |
590 | typedef DIR* SYS_DIR; | |
591 | typedef struct dirent SYS_DIRENT; | |
592 | #endif /* XP_UNIX */ | |
593 | ||
594 | #ifdef XP_WIN32 | |
595 | ||
596 | typedef struct dirent_s dirent_s; | |
597 | struct dirent_s { | |
598 | char *d_name; | |
599 | }; | |
600 | ||
601 | typedef struct dir_s dir_s; | |
602 | struct dir_s { | |
603 | HANDLE dp; | |
604 | WIN32_FIND_DATA fdata; | |
605 | dirent_s de; | |
606 | }; | |
607 | ||
608 | typedef dir_s* SYS_DIR; | |
609 | typedef dirent_s SYS_DIRENT; | |
610 | ||
611 | #endif /* XP_WIN32 */ | |
612 | ||
613 | typedef struct pb_param pb_param; | |
614 | struct pb_param { | |
615 | char *name,*value; | |
616 | }; | |
617 | ||
618 | typedef struct pb_entry pb_entry; | |
619 | struct pb_entry { | |
620 | pb_param *param; | |
621 | struct pb_entry *next; | |
622 | }; | |
623 | ||
624 | typedef struct pblock pblock; | |
625 | struct pblock { | |
626 | int hsize; | |
627 | struct pb_entry **ht; | |
628 | }; | |
629 | ||
630 | #ifndef POOL_HANDLE_T | |
631 | #define POOL_HANDLE_T | |
632 | typedef void *pool_handle_t; | |
633 | #endif | |
634 | ||
635 | #ifndef SEMAPHORE_T | |
636 | typedef void *SEMAPHORE; | |
637 | #define SEMAPHORE_T void * | |
638 | #endif /* !SEMAPHORE_T */ | |
639 | ||
640 | #define SESSION_HASHSIZE 5 | |
641 | ||
642 | typedef struct PListStruct_s PListStruct_s; | |
643 | typedef struct ACLListHandle ACLListHandle; | |
644 | ||
645 | #ifndef PR_AF_INET | |
646 | typedef union PRNetAddr PRNetAddr; | |
647 | #endif | |
648 | ||
649 | typedef struct Session Session; | |
650 | typedef struct Request Request; | |
651 | struct Session { | |
652 | pblock *client; /* client-specific information */ | |
653 | ||
654 | SYS_NETFD csd; /* client file descriptor */ | |
655 | netbuf *inbuf; /* input buffer */ | |
656 | int csd_open; | |
657 | ||
658 | struct in_addr iaddr; | |
659 | ||
660 | pool_handle_t *pool; | |
661 | ||
662 | void *clauth; /* v2 ACL client authentication information */ | |
663 | struct Session *next; | |
664 | int fill; | |
665 | struct sockaddr_in local_addr; /* local addr for this session */ | |
666 | ||
667 | PListStruct_s *subject; | |
668 | int ssl; /* 0 = SSL OFF, 1 = SSL ON */ | |
669 | int clientauth; /* 0 = client auth OFF, 1 = client auth ON */ | |
670 | ||
671 | PRNetAddr *pr_client_addr; | |
672 | PRNetAddr *pr_local_addr; | |
673 | }; | |
674 | ||
675 | /* | |
676 | * FuncPtr is a pointer to an NSAPI SAF function | |
677 | */ | |
678 | ||
679 | #ifdef XP_UNIX | |
680 | typedef int Func(pblock *, Session *, Request *); | |
681 | #else /* XP_WIN32 */ | |
682 | typedef int _cdecl Func(pblock *, Session *, Request *); | |
683 | #endif /* XP_WIN32 */ | |
684 | ||
685 | typedef Func *FuncPtr; | |
686 | ||
687 | /* | |
688 | * FuncStruct is a structure used in the static declaration of the | |
689 | * functions. This static declaration is parsed into a hash table at | |
690 | * startup. | |
691 | */ | |
692 | ||
693 | typedef struct FuncStruct FuncStruct; | |
694 | ||
695 | struct FuncStruct { | |
696 | const char * name; | |
697 | FuncPtr func; | |
698 | struct FuncStruct *next; | |
699 | unsigned flags; | |
700 | unsigned poolID; | |
701 | unsigned pool_resolved; | |
702 | }; | |
703 | ||
19
d680536f8c2f
Added configuration manager
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
14
diff
changeset
|
704 | ////// new |
d680536f8c2f
Added configuration manager
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
14
diff
changeset
|
705 | |
d680536f8c2f
Added configuration manager
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
14
diff
changeset
|
706 | typedef struct _http_listener HttpListener; |
d680536f8c2f
Added configuration manager
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
14
diff
changeset
|
707 | |
d680536f8c2f
Added configuration manager
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
14
diff
changeset
|
708 | ////// |
1 | 709 | /* |
710 | * VSInitFunc, VSDestroyFunc, VSDirectiveInitFunc and VSDirectiveDestroyFunc | |
711 | */ | |
712 | typedef struct VirtualServer VirtualServer; | |
713 | typedef int VSInitFunc(VirtualServer *incoming, const VirtualServer *current); | |
714 | typedef void VSDestroyFunc(VirtualServer *outgoing); | |
715 | typedef VSInitFunc *VSInitFuncPtr; | |
716 | typedef VSDestroyFunc *VSDestroyFuncPtr; | |
717 | typedef int VSDirectiveInitFunc(const directive *dir, VirtualServer *incoming, const VirtualServer *current); | |
718 | typedef void VSDirectiveDestroyFunc(const directive *dir, VirtualServer *outgoing); | |
719 | typedef VSDirectiveInitFunc *VSDirectiveInitFuncPtr; | |
720 | typedef VSDirectiveDestroyFunc *VSDirectiveDestroyFuncPtr; | |
721 | ||
722 | /* | |
723 | * Filter is an opaque filter identifier | |
724 | */ | |
725 | typedef struct Filter Filter; | |
726 | ||
727 | /* | |
728 | * FilterContext stores context associated with a particular filter layer | |
729 | */ | |
730 | ||
731 | typedef struct FilterContext FilterContext; | |
732 | ||
733 | struct FilterContext { | |
734 | pool_handle_t *pool; /* pool context was allocated from */ | |
735 | Session *sn; /* session being processed */ | |
736 | Request *rq; /* request being processed */ | |
737 | void *data; /* filter-defined private data */ | |
738 | }; | |
739 | ||
740 | /* | |
741 | * FilterLayer represents one layer of a filter stack | |
742 | */ | |
743 | ||
744 | typedef struct FilterLayer FilterLayer; | |
745 | ||
746 | struct FilterLayer { | |
747 | Filter *filter; /* the filter at this layer in the filter stack */ | |
748 | FilterContext *context; /* context for the filter */ | |
749 | SYS_NETFD lower; /* access to the next filter layer in the stack */ | |
750 | }; | |
751 | ||
752 | /* | |
753 | * Function prototypes for filter methods | |
754 | */ | |
21
627b09ee74e4
New configuration loader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
19
diff
changeset
|
755 | |
627b09ee74e4
New configuration loader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
19
diff
changeset
|
756 | /* |
627b09ee74e4
New configuration loader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
19
diff
changeset
|
757 | * TODO: modified: added * bevor Filter...Func |
627b09ee74e4
New configuration loader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
19
diff
changeset
|
758 | */ |
627b09ee74e4
New configuration loader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
19
diff
changeset
|
759 | typedef int (*FilterInsertFunc)(FilterLayer *layer, pblock *pb); |
627b09ee74e4
New configuration loader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
19
diff
changeset
|
760 | typedef void (*FilterRemoveFunc)(FilterLayer *layer); |
627b09ee74e4
New configuration loader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
19
diff
changeset
|
761 | typedef int (*FilterFlushFunc)(FilterLayer *layer); |
627b09ee74e4
New configuration loader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
19
diff
changeset
|
762 | typedef int (*FilterReadFunc)(FilterLayer *layer, void *buf, int amount, int timeout); |
627b09ee74e4
New configuration loader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
19
diff
changeset
|
763 | typedef int (*FilterWriteFunc)(FilterLayer *layer, const void *buf, int amount); |
627b09ee74e4
New configuration loader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
19
diff
changeset
|
764 | typedef int (*FilterWritevFunc)(FilterLayer *layer, const NSAPIIOVec *iov, int iov_size); |
627b09ee74e4
New configuration loader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
19
diff
changeset
|
765 | typedef int (*FilterSendfileFunc)(FilterLayer *layer, sendfiledata *sfd); |
1 | 766 | |
767 | /* | |
768 | * FilterMethods is passed to filter_create() to declare the filter methods for | |
769 | * a new filter. Each instance of the FilterMethods structure should be | |
770 | * initialized using the FILTER_METHODS_INITIALIZER macro. | |
771 | */ | |
772 | ||
773 | typedef struct FilterMethods FilterMethods; | |
774 | ||
775 | struct FilterMethods { | |
776 | size_t size; | |
777 | #if NSAPI_VERSION >= 302 | |
778 | FilterInsertFunc *insert; | |
779 | FilterRemoveFunc *remove; | |
780 | FilterFlushFunc *flush; | |
781 | FilterReadFunc *read; | |
782 | FilterWriteFunc *write; | |
783 | FilterWritevFunc *writev; | |
784 | FilterSendfileFunc *sendfile; | |
785 | #else | |
786 | void *reserved1; | |
787 | void *reserved2; | |
788 | void *reserved3; | |
789 | void *reserved4; | |
790 | void *reserved5; | |
791 | void *reserved6; | |
792 | void *reserved7; | |
793 | #endif /* NSAPI_VERSION >= 302 */ | |
794 | }; | |
795 | ||
796 | #define FILTER_METHODS_INITIALIZER \ | |
797 | { \ | |
798 | sizeof(FilterMethods), \ | |
799 | NULL, /* insert */ \ | |
800 | NULL, /* remove */ \ | |
801 | NULL, /* flush */ \ | |
802 | NULL, /* read */ \ | |
803 | NULL, /* write */ \ | |
804 | NULL, /* writev */ \ | |
805 | NULL /* sendfile */ \ | |
806 | } | |
807 | ||
808 | /* | |
809 | * Filter order definitions for filter_create() | |
810 | */ | |
811 | #define FILTER_CONTENT_GENERATION 0xf0000 | |
812 | #define FILTER_CONTENT_TRANSLATION_HIGH 0xa0000 | |
813 | #define FILTER_CONTENT_TRANSLATION 0x90000 | |
814 | #define FILTER_CONTENT_TRANSLATION_LOW 0x80000 | |
815 | #define FILTER_CONTENT_CODING 0x50000 | |
816 | #define FILTER_TRANSFER_CODING 0x40000 | |
817 | #define FILTER_MESSAGE_CODING 0x30000 | |
818 | #define FILTER_TRANSPORT_CODING 0x20000 | |
819 | #define FILTER_NETWORK 0x10000 | |
820 | ||
821 | typedef struct shmem_s shmem_s; | |
822 | struct shmem_s { | |
823 | void *data; /* the data */ | |
824 | #ifdef XP_WIN32 | |
825 | HANDLE fdmap; | |
826 | #endif /* XP_WIN32 */ | |
827 | int size; /* the maximum length of the data */ | |
828 | ||
829 | char *name; /* internal use: filename to unlink if exposed */ | |
830 | SYS_FILE fd; /* internal use: file descriptor for region */ | |
831 | }; | |
832 | ||
833 | /* Define a handle for a thread */ | |
29
e8619defde14
added event handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
23
diff
changeset
|
834 | //typedef void* SYS_THREAD; |
e8619defde14
added event handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
23
diff
changeset
|
835 | typedef pthread_t SYS_THREAD; |
1 | 836 | |
837 | /* Define an error value for the thread handle */ | |
838 | #define SYS_THREAD_ERROR NULL | |
839 | ||
840 | ||
841 | typedef struct conf_global_vars_s conf_global_vars_s; | |
842 | struct conf_global_vars_s { | |
843 | ||
844 | /* What port we listen to */ | |
845 | int Vport; /* OBSOLETE */ | |
9
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
846 | #define server_portnum 80 |
1 | 847 | |
848 | /* What address to bind to */ | |
849 | char *Vaddr; /* OBSOLETE */ | |
850 | ||
851 | /* User to run as */ | |
852 | struct passwd *Vuserpw; | |
853 | ||
854 | /* Directory to chroot to */ | |
855 | char *Vchr; | |
856 | ||
857 | /* Where to log our pid to */ | |
858 | char *Vpidfn; | |
859 | ||
860 | #define pool_max conf_getglobals()->Vpool_max | |
861 | int Vpool_max; | |
862 | #define pool_min conf_getglobals()->Vpool_min | |
863 | int Vpool_min; /* OBSOLETE */ | |
864 | #define pool_life conf_getglobals()->Vpool_life | |
865 | int Vpool_life; /* OBSOLETE */ | |
866 | ||
867 | /* For multiprocess UNIX servers, the maximum threads per process */ | |
868 | #define pool_maxthreads conf_getglobals()->Vpool_maxthreads | |
869 | int Vpool_maxthreads; | |
870 | ||
871 | #define pool_minthreads conf_getglobals()->Vpool_minthreads | |
872 | int Vpool_minthreads; /* OBSOLETE */ | |
873 | ||
874 | char *Vsecure_keyfn; /* OBSOLETE */ | |
875 | char *Vsecure_certfn; /* OBSOLETE */ | |
876 | ||
9
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
877 | #define security_active 0 |
1 | 878 | int Vsecurity_active; |
879 | int Vssl3_active; /* OBSOLETE */ | |
880 | int Vssl2_active; /* OBSOLETE */ | |
881 | int Vsecure_auth; /* OBSOLETE */ | |
882 | int Vsecurity_session_timeout; | |
883 | long Vssl3_session_timeout; | |
884 | ||
885 | /* The server's hostname as should be reported in self-ref URLs */ | |
9
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
886 | #define server_hostname "x4" |
1 | 887 | char *Vserver_hostname; |
888 | ||
889 | /* The main object from which all are derived */ | |
890 | #define root_object conf_getglobals()->Vroot_object | |
891 | char *Vroot_object; | |
892 | ||
893 | /* The object set the administrator has asked us to load */ | |
894 | #define std_os conf_getglobals()->Vstd_os | |
895 | httpd_objset *Vstd_os; | |
896 | ||
897 | /* The root of ACL data structures */ | |
898 | void *Vacl_root; | |
899 | ||
900 | /* The main error log, where all errors are logged */ | |
901 | char *Vmaster_error_log; | |
902 | ||
903 | /* The server root directory (contains instance subdirectories) */ | |
904 | #define server_root conf_getglobals()->Vserver_root | |
905 | char *Vserver_root; | |
906 | ||
907 | /* This server's id */ | |
908 | #define server_id conf_getglobals()->Vserver_id | |
909 | char *Vserver_id; | |
910 | ||
911 | /* Admin server users file */ | |
912 | char *Vadmin_users; | |
913 | ||
914 | /* The installation directory (contains bin and lib subdirectories) */ | |
915 | char *Vnetsite_root; | |
916 | ||
917 | /* Digest authentication stale nonce timeout value */ | |
918 | int digest_stale_timeout; | |
919 | ||
920 | int single_accept; /* OBSOLETE */ | |
921 | int num_keep_alives; /* OBSOLETE */ | |
922 | int log_verbose; /* OBSOLETE */ | |
923 | int mmap_flags; /* OBSOLETE */ | |
924 | int mmap_prots; /* OBSOLETE */ | |
925 | int unused1; | |
926 | int unused2; | |
927 | ||
928 | /* Begin Enterprise 3.0 fields */ | |
929 | int accept_language; /* turn accept-language on/off */ | |
930 | ||
931 | char *mtahost; | |
932 | char *nntphost; /* OBSOLETE */ | |
933 | ||
934 | /* The root of ACL data structures */ | |
935 | void *Vacl_root_30; | |
936 | ||
937 | char *agentFilePath; /* OBSOLETE */ | |
938 | ||
939 | int Allowed; /* OBSOLETE */ | |
940 | ||
941 | pblock *genericGlobals; /* OBSOLETE */ | |
942 | ||
943 | char *agentsACLFile; /* OBSOLETE */ | |
944 | ||
945 | int wait_for_cgi; /* OBSOLETE */ | |
946 | int cgiwatch_timeout; /* OBSOLETE */ | |
947 | int started_by_watchdog; | |
948 | int restarted_by_watchdog; | |
949 | int old_accel_cache_enabled; /* OBSOLETE */ | |
950 | int Vssl_cache_entries; | |
951 | int blocking_listen_socket; /* OBSOLETE */ | |
952 | pblock **initfns; | |
953 | char *vs_config_file; /* OBSOLETE */ | |
954 | }; | |
955 | ||
956 | /* Type used for Request rq_attr bit flags */ | |
957 | #ifdef AIX | |
958 | #define RQATTR unsigned | |
959 | #else | |
960 | #define RQATTR unsigned long | |
961 | #endif | |
962 | ||
963 | struct Request { | |
964 | /* Server working variables */ | |
965 | pblock *vars; | |
966 | ||
967 | /* The method, URI, and protocol revision of this request */ | |
968 | pblock *reqpb; | |
969 | /* Protocol specific headers */ | |
970 | int loadhdrs; | |
971 | pblock *headers; | |
972 | ||
973 | /* Server's response headers */ | |
974 | int senthdrs; | |
975 | pblock *srvhdrs; | |
976 | ||
977 | /* The object set constructed to fulfill this request */ | |
978 | httpd_objset *os; | |
979 | /* Array of objects that were created from .nsconfig files */ | |
980 | httpd_objset *tmpos; | |
981 | ||
982 | /* The stat last returned by request_stat_path */ | |
983 | char *statpath; | |
984 | char *staterr; | |
985 | struct stat *finfo; | |
986 | ||
987 | /* access control state */ | |
988 | int aclstate; /* ACL decision state */ | |
989 | int acldirno; /* deciding ACL directive number */ | |
990 | char *aclname; /* name of deciding ACL */ | |
991 | pblock *aclpb; /* OBSOLETE */ | |
992 | /* 3.0 ACL list pointer */ | |
993 | ACLListHandle *acllist; | |
994 | ||
995 | int request_is_cacheable; /* */ | |
996 | int directive_is_cacheable; /* set by SAFs with no external side effects that make decisions based solely on URI and path */ | |
997 | ||
998 | char *cached_headers; /* OBSOLETE */ | |
999 | int cached_headers_len; /* OBSOLETE */ | |
1000 | char *unused; | |
1001 | ||
1002 | /* HTTP/1.1 features */ | |
1003 | #define REQ_TIME(x) (x)->req_start | |
1004 | time_t req_start; /* time request arrived - used for selecting weak or strong cache validation */ | |
1005 | short protv_num; /* protocol version number */ | |
1006 | short method_num; /* method number */ | |
1007 | struct rq_attr { | |
1008 | RQATTR abs_uri:1; /* set if absolute URI was used */ | |
1009 | RQATTR chunked:1; /* chunked transfer-coding */ | |
1010 | RQATTR keep_alive:1; /* connection keep-alive */ | |
1011 | RQATTR pipelined:1; /* request packet is pipelined */ | |
1012 | RQATTR internal_req:1; /* this was an internal request */ | |
1013 | RQATTR perm_req:1; /* don't FREE() this request */ | |
1014 | RQATTR header_file_present:1; /* OBSOLETE */ | |
1015 | RQATTR footer_file_present:1; /* OBSOLETE */ | |
1016 | RQATTR jvm_attached:1; /* OBSOLETE */ | |
1017 | RQATTR req_restarted:1; /* request was restarted */ | |
1018 | RQATTR jvm_request_locked:1; /* used for first-request serialization on some platforms */ | |
1019 | RQATTR default_type_set:1; /* set if default types were set using set-default-type objecttype function */ | |
1020 | RQATTR is_web_app:1; /* OBSOLETE */ | |
1021 | RQATTR ssl_unclean_shutdown:1; /* set if browser requires unclean SSL shutdown */ | |
1022 | RQATTR vary_accept_language:1; /* set if request was restarted based on an accept-language header */ | |
1023 | RQATTR reserved:17; /* if you add a flag, make sure to subtract from this */ | |
1024 | } rq_attr; | |
1025 | char *hostname; /* hostname used to access server (always non-NULL) */ | |
1026 | int allowed; /* OBSOLETE */ | |
1027 | int byterange; /* OBSOLETE */ | |
1028 | short status_num; /* HTTP status code */ | |
1029 | ||
1030 | int staterrno; /* used for rqstat */ | |
1031 | Request *orig_rq; /* original Request - used for internal redirects */ | |
1032 | }; | |
1033 | ||
1034 | /* Request attribute macros */ | |
1035 | #define ABS_URI(x) (x)->rq_attr.abs_uri | |
1036 | #define CHUNKED(x) (x)->rq_attr.chunked | |
1037 | #define KEEP_ALIVE(x) (x)->rq_attr.keep_alive | |
1038 | #define PIPELINED(x) (x)->rq_attr.pipelined | |
1039 | #define INTERNAL_REQUEST(x) (x)->rq_attr.internal_req | |
1040 | #define RESTARTED_REQUEST(x) (x)->rq_attr.req_restarted | |
1041 | #define PERM_REQUEST(x) (x)->rq_attr.perm_req | |
1042 | #define JVM_REQUEST_LOCKED(x) (x)->rq_attr.jvm_request_locked | |
1043 | #define SSL_UNCLEAN_SHUTDOWN(x) (x)->rq_attr.ssl_unclean_shutdown | |
1044 | #define VARY_ACCEPT_LANGUAGE(x) (x)->rq_attr.vary_accept_language | |
1045 | ||
1046 | /* Define methods for HTTP/1.1 */ | |
1047 | #define METHOD_HEAD 0 | |
1048 | #define METHOD_GET 1 | |
1049 | #define METHOD_PUT 2 | |
1050 | #define METHOD_POST 3 | |
1051 | #define METHOD_DELETE 4 | |
1052 | #define METHOD_TRACE 5 | |
1053 | #define METHOD_OPTIONS 6 | |
1054 | /* The following methods are Netscape method extensions */ | |
1055 | #define METHOD_MOVE 7 | |
1056 | #define METHOD_INDEX 8 | |
1057 | #define METHOD_MKDIR 9 | |
1058 | #define METHOD_RMDIR 10 | |
1059 | #define METHOD_COPY 11 | |
1060 | #define METHOD_MAX 12 /* Number of methods available on this server */ | |
1061 | ||
1062 | #define ISMGET(r) ((r)->method_num == METHOD_GET) | |
1063 | #define ISMHEAD(r) ((r)->method_num == METHOD_HEAD) | |
1064 | #define ISMPUT(r) ((r)->method_num == METHOD_PUT) | |
1065 | #define ISMPOST(r) ((r)->method_num == METHOD_POST) | |
1066 | #define ISMDELETE(r) ((r)->method_num == METHOD_DELETE) | |
1067 | #define ISMMOVE(r) ((r)->method_num == METHOD_MOVE) | |
1068 | #define ISMINDEX(r) ((r)->method_num == METHOD_INDEX) | |
1069 | #define ISMMKDIR(r) ((r)->method_num == METHOD_MKDIR) | |
1070 | #define ISMRMDIR(r) ((r)->method_num == METHOD_RMDIR) | |
1071 | #define ISMCOPY(r) ((r)->method_num == METHOD_COPY) | |
1072 | #define ISMTRACE(r) ((r)->method_num == METHOD_TRACE) | |
1073 | #define ISMOPTIONS(r) ((r)->method_num == METHOD_OPTIONS) | |
1074 | ||
1075 | ||
1076 | /* --- End type definitions --- */ | |
1077 | ||
1078 | /* --- Begin dispatch vector table definition --- */ | |
1079 | /* --- End dispatch vector table definition --- */ | |
1080 | ||
1081 | /* --- Begin API macro definitions --- */ | |
1082 | ||
1083 | #ifndef INTNSAPI | |
1084 | ||
1085 | #if NSAPI_VERSION >= 301 | |
1086 | ||
1087 | /* | |
1088 | * In Sun ONE Web Server 6.1 and higher, http_parse_request("", NULL, NULL) | |
1089 | * returns the NSAPI version. In previous releases, it returns -1. | |
1090 | */ | |
1091 | #define __NSAPI_RUNTIME_VERSION \ | |
1092 | ((*__nsapi30_table->f_http_parse_request)("", NULL, NULL)) | |
1093 | ||
1094 | /* | |
1095 | * NSAPI_RUNTIME_VERSION returns the NSAPI version the server implements. The | |
1096 | * returned NSAPI version number is reliable only in iPlanet Web Server 6.0, | |
1097 | * Netscape Enterprise Server 6.0, and Sun ONE Web Server 6.0 and higher. | |
1098 | */ | |
1099 | #define NSAPI_RUNTIME_VERSION \ | |
1100 | (__NSAPI_RUNTIME_VERSION > 0 ? __NSAPI_RUNTIME_VERSION : 301) | |
1101 | ||
1102 | #endif /* NSAPI_VERSION >= 301 */ | |
1103 | ||
1104 | #define system_version (*__nsapi30_table->f_system_version) | |
1105 | ||
1106 | /* | |
1107 | * Depending on the system, memory allocated via these macros may come from | |
1108 | * an arena. If these functions are called from within an Init function, they | |
1109 | * will be allocated from permanent storage. Otherwise, they will be freed | |
1110 | * when the current request is finished. | |
1111 | */ | |
1112 | ||
1113 | ||
1114 | ||
1115 | #endif /* !INTNSAPI */ | |
1116 | ||
1117 | #ifdef XP_UNIX | |
1118 | #define dir_open opendir | |
1119 | #define dir_read readdir | |
1120 | #define dir_close closedir | |
1121 | #define dir_create(path) mkdir(path, 0755) | |
1122 | #define dir_remove rmdir | |
1123 | #define system_chdir chdir | |
1124 | #define file_unix2local(path,p2) strcpy(p2,path) | |
1125 | #endif /* XP_UNIX */ | |
1126 | ||
1127 | #ifdef XP_WIN32 | |
1128 | #define dir_create _mkdir | |
1129 | #define dir_remove _rmdir | |
1130 | #define system_chdir SetCurrentDirectory | |
1131 | #endif /* XP_WIN32 */ | |
1132 | ||
1133 | /* | |
1134 | * Thread-safe variants of localtime and gmtime | |
1135 | */ | |
1136 | #define system_localtime(curtime, ret) util_localtime(curtime, ret) | |
1137 | #define system_gmtime(curtime, ret) util_gmtime(curtime, ret) | |
1138 | ||
1139 | /* | |
1140 | * pblock_find finds the entry with the given name in pblock pb. | |
1141 | * | |
1142 | * If it is successful, it returns the param block. If not, it returns NULL. | |
1143 | */ | |
1144 | #define pblock_find(name, pb) (pblock_fr(name,pb,0)) | |
1145 | ||
1146 | /* | |
1147 | * pblock_remove behaves exactly like pblock_find, but removes the given | |
1148 | * entry from pb. | |
1149 | */ | |
1150 | #define pblock_remove(name, pb) (pblock_fr(name,pb,1)) | |
1151 | ||
1152 | /* | |
1153 | * session_dns returns the DNS hostname of the client of this session, | |
1154 | * and inserts it into the client pblock. Returns NULL if unavailable. | |
1155 | */ | |
1156 | #define session_dns(sn) session_dns_lookup(sn, 0) | |
1157 | ||
1158 | /* | |
1159 | * session_maxdns looks up a hostname from an IP address, and then verifies | |
1160 | * that the host is really who they claim to be. | |
1161 | */ | |
1162 | #define session_maxdns(sn) session_dns_lookup(sn, 1) | |
1163 | ||
9
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1164 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1165 | /* nsapi functions */ |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1166 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1167 | ssize_t net_write(SYS_NETFD fd, void *buf, size_t nbytes); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1168 | |
23
a2c8fc23c90e
Added basic authentication
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
21
diff
changeset
|
1169 | ssize_t net_printf(SYS_NETFD fd, char *format, ...); |
a2c8fc23c90e
Added basic authentication
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
21
diff
changeset
|
1170 | |
a2c8fc23c90e
Added basic authentication
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
21
diff
changeset
|
1171 | |
9
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1172 | NSAPI_PUBLIC pb_param *INTparam_create(const char *name, const char *value); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1173 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1174 | NSAPI_PUBLIC int INTparam_free(pb_param *pp); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1175 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1176 | NSAPI_PUBLIC pblock *INTpblock_create(int n); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1177 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1178 | NSAPI_PUBLIC void INTpblock_free(pblock *pb); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1179 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1180 | NSAPI_PUBLIC char *INTpblock_findval(const char *name, const pblock *pb); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1181 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1182 | NSAPI_PUBLIC pb_param *INTpblock_nvinsert(const char *name, const char *value, pblock *pb); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1183 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1184 | NSAPI_PUBLIC pb_param *pblock_nvlinsert(const char *name, int namelen, const char *value, int valuelen, pblock *pb); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1185 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1186 | NSAPI_PUBLIC pb_param *INTpblock_nninsert(const char *name, int value, pblock *pb); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1187 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1188 | NSAPI_PUBLIC void INTpblock_pinsert(pb_param *pp, pblock *pb); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1189 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1190 | NSAPI_PUBLIC int INTpblock_str2pblock(const char *str, pblock *pb); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1191 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1192 | NSAPI_PUBLIC char *INTpblock_pblock2str(const pblock *pb, char *str); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1193 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1194 | NSAPI_PUBLIC int INTpblock_copy(const pblock *src, pblock *dst); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1195 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1196 | NSAPI_PUBLIC pblock *INTpblock_dup(const pblock *src); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1197 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1198 | NSAPI_PUBLIC char **INTpblock_pb2env(const pblock *pb, char **env); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1199 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1200 | NSAPI_PUBLIC void pblock_nvreplace (const char *name, const char *value, pblock *pb); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1201 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1202 | NSAPI_PUBLIC pb_param *pblock_param_create(pblock *pb, const char *name, const char *value); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1203 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1204 | NSAPI_PUBLIC pblock *pblock_create_pool(pool_handle_t *pool_handle, int n); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1205 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1206 | NSAPI_PUBLIC pb_param *INTpblock_fr(const char *name, pblock *pb, int remove); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1207 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1208 | NSAPI_PUBLIC char *INTpblock_replace(const char *name,char * new_value,pblock *pb); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1209 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1210 | NSAPI_PUBLIC int INTpblock_str2pblock_lowercasename(const char *str, pblock *pb); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1211 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1212 | //NSAPI_PUBLIC pb_param *pblock_removeone(pblock *pb); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1213 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1214 | //NSAPI_PUBLIC const pb_key *pblock_key(const char *name); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1215 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1216 | //NSAPI_PUBLIC pb_param *pblock_key_param_create(pblock *pb, const pb_key *key, const char *value, int valuelen); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1217 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1218 | //NSAPI_PUBLIC char *pblock_findkeyval(const pb_key *key, const pblock *pb); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1219 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1220 | //NSAPI_PUBLIC pb_param *pblock_findkey(const pb_key *key, const pblock *pb); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1221 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1222 | //NSAPI_PUBLIC pb_param *pblock_removekey(const pb_key *key, pblock *pb); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1223 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1224 | //NSAPI_PUBLIC pb_param *pblock_kvinsert(const pb_key *key, const char *value, int valuelen, pblock *pb); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1225 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1226 | //NSAPI_PUBLIC void pblock_kpinsert(const pb_key *key, pb_param *pp, pblock *pb); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1227 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1228 | //NSAPI_PUBLIC void pblock_kvreplace(const pb_key *key, const char *value, int valuelen, pblock *pb); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1229 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1230 | //NSAPI_PUBLIC pb_param *pblock_kninsert(const pb_key *key, int value, pblock *pb); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1231 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1232 | //NSAPI_PUBLIC pb_param *pblock_kllinsert(const pb_key *key, PRInt64 value, pblock *pb); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1233 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1234 | #define param_create INTparam_create |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1235 | #define param_free INTparam_free |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1236 | #define pblock_create INTpblock_create |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1237 | #define pblock_free INTpblock_free |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1238 | #define pblock_findval INTpblock_findval |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1239 | #define pblock_nvinsert INTpblock_nvinsert |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1240 | #define pblock_nninsert INTpblock_nninsert |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1241 | #define pblock_pinsert INTpblock_pinsert |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1242 | #define pblock_str2pblock INTpblock_str2pblock |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1243 | #define pblock_pblock2str INTpblock_pblock2str |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1244 | #define pblock_copy INTpblock_copy |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1245 | #define pblock_dup INTpblock_dup |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1246 | #define pblock_pb2env INTpblock_pb2env |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1247 | #define pblock_fr INTpblock_fr |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1248 | #define pblock_replace INTpblock_replace |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1249 | |
23
a2c8fc23c90e
Added basic authentication
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
21
diff
changeset
|
1250 | // func util functions |
a2c8fc23c90e
Added basic authentication
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
21
diff
changeset
|
1251 | FuncStruct* func_resolve(pblock *pb, Session *sn, Request *rq); |
a2c8fc23c90e
Added basic authentication
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
21
diff
changeset
|
1252 | int func_exec (pblock *pb, Session *sn, Request *rq); |
a2c8fc23c90e
Added basic authentication
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
21
diff
changeset
|
1253 | |
9
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1254 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1255 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1256 | void protocol_status(Session *sn, Request *rq, int n, const char *m); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1257 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1258 | int http_start_response(Session *sn, Request *rq); |
1 | 1259 | #define protocol_start_response http_start_response |
9
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1260 | int request_header(char *name, char **value, Session *sn, Request *rq); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1261 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1262 | typedef void (*thrstartfunc)(void *); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1263 | SYS_THREAD INTsysthread_start(int prio, int stksz, thrstartfunc fn, void *arg); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1264 | NSAPI_PUBLIC void INTsysthread_sleep(int milliseconds); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1265 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1266 | #define systhread_start INTsysthread_start |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1267 | #define systhread_sleep INTsysthread_sleep |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1268 | |
1 | 1269 | |
9
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1270 | void webserver_atrestart(void (*fn)(void *), void *data); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1271 | #define magnus_atrestart webserver_atrestart |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1272 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1273 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1274 | NSAPI_PUBLIC int INTshexp_match(const char *str, const char *exp); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1275 | #define shexp_match INTshexp_match |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1276 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1277 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1278 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1279 | NSAPI_PUBLIC char *session_dns_lookup(Session *s, int verify); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1280 | |
1 | 1281 | |
8
f4d56bf9de40
Added request body reader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
6
diff
changeset
|
1282 | |
f4d56bf9de40
Added request body reader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
6
diff
changeset
|
1283 | /* new macro and function definitions begin */ |
f4d56bf9de40
Added request body reader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
6
diff
changeset
|
1284 | |
f4d56bf9de40
Added request body reader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
6
diff
changeset
|
1285 | /* netbuf functions */ |
f4d56bf9de40
Added request body reader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
6
diff
changeset
|
1286 | NSAPI_PUBLIC netbuf *netbuf_open(SYS_NETFD sd, int sz); |
f4d56bf9de40
Added request body reader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
6
diff
changeset
|
1287 | |
f4d56bf9de40
Added request body reader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
6
diff
changeset
|
1288 | NSAPI_PUBLIC void netbuf_close(netbuf *buf); |
f4d56bf9de40
Added request body reader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
6
diff
changeset
|
1289 | |
f4d56bf9de40
Added request body reader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
6
diff
changeset
|
1290 | NSAPI_PUBLIC unsigned char * netbuf_replace(netbuf *buf, |
f4d56bf9de40
Added request body reader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
6
diff
changeset
|
1291 | unsigned char *inbuf, int pos, int cursize, int maxsize); |
f4d56bf9de40
Added request body reader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
6
diff
changeset
|
1292 | |
f4d56bf9de40
Added request body reader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
6
diff
changeset
|
1293 | NSAPI_PUBLIC int netbuf_next(netbuf *buf, int advance); |
f4d56bf9de40
Added request body reader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
6
diff
changeset
|
1294 | |
f4d56bf9de40
Added request body reader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
6
diff
changeset
|
1295 | NSAPI_PUBLIC int netbuf_getbytes(netbuf *buf, char *buffer, int size); |
f4d56bf9de40
Added request body reader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
6
diff
changeset
|
1296 | |
f4d56bf9de40
Added request body reader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
6
diff
changeset
|
1297 | NSAPI_PUBLIC int netbuf_grab(netbuf *buf, int sz); |
f4d56bf9de40
Added request body reader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
6
diff
changeset
|
1298 | |
21
627b09ee74e4
New configuration loader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
19
diff
changeset
|
1299 | #define netbuf_open netbuf_open |
627b09ee74e4
New configuration loader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
19
diff
changeset
|
1300 | #define netbuf_close netbuf_close |
627b09ee74e4
New configuration loader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
19
diff
changeset
|
1301 | #define netbuf_replace netbuf_replace |
627b09ee74e4
New configuration loader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
19
diff
changeset
|
1302 | #define netbuf_next netbuf_next |
627b09ee74e4
New configuration loader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
19
diff
changeset
|
1303 | #define netbuf_getbytes netbuf_getbytes |
627b09ee74e4
New configuration loader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
19
diff
changeset
|
1304 | #define netbuf_grab netbuf_grab |
627b09ee74e4
New configuration loader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
19
diff
changeset
|
1305 | |
627b09ee74e4
New configuration loader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
19
diff
changeset
|
1306 | |
627b09ee74e4
New configuration loader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
19
diff
changeset
|
1307 | |
8
f4d56bf9de40
Added request body reader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
6
diff
changeset
|
1308 | /* end new macro and function definitions */ |
f4d56bf9de40
Added request body reader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
6
diff
changeset
|
1309 | |
1 | 1310 | #define SYS_STDERR STDERR_FILENO |
1311 | ||
1312 | #ifdef XP_WIN32 | |
1313 | ||
1314 | typedef HANDLE pid_t; | |
1315 | ||
1316 | #define ERROR_PIPE \ | |
1317 | (ERROR_BROKEN_PIPE | ERROR_BAD_PIPE | \ | |
1318 | ERROR_PIPE_BUSY | ERROR_PIPE_LISTENING | ERROR_PIPE_NOT_CONNECTED) | |
1319 | #define CONVERT_TO_PRINTABLE_FORMAT(Filename) \ | |
1320 | { \ | |
1321 | register char *s; \ | |
1322 | if (Filename) \ | |
1323 | for (s = Filename; *s; s++) \ | |
1324 | if ( *s == '\\') \ | |
1325 | *s = '/'; \ | |
1326 | } | |
1327 | #define CONVERT_TO_NATIVE_FS(Filename) \ | |
1328 | { \ | |
1329 | register char *s; \ | |
1330 | if (Filename) \ | |
1331 | for (s = Filename; *s; s++) \ | |
1332 | if ( *s == '/') \ | |
1333 | *s = '\\'; \ | |
1334 | } | |
1335 | ||
1336 | #ifdef INTNSAPI | |
1337 | NSAPI_PUBLIC extern nsapi_dispatch_t *__nsapi30_table; | |
1338 | #if NSAPI_VERSION >= 302 | |
1339 | NSAPI_PUBLIC extern nsapi302_dispatch_t *__nsapi302_table; | |
1340 | #endif /* NSAPI_VERSION >= 302 */ | |
1341 | #if NSAPI_VERSION >= 303 | |
1342 | NSAPI_PUBLIC extern nsapi303_dispatch_t *__nsapi303_table; | |
1343 | #endif /* NSAPI_VERSION >= 303 */ | |
1344 | #else | |
1345 | __declspec(dllimport) nsapi_dispatch_t *__nsapi30_table; | |
1346 | #if NSAPI_VERSION >= 302 | |
1347 | __declspec(dllimport) nsapi302_dispatch_t *__nsapi302_table; | |
1348 | #endif /* NSAPI_VERSION >= 302 */ | |
1349 | #if NSAPI_VERSION >= 303 | |
1350 | __declspec(dllimport) nsapi303_dispatch_t *__nsapi303_table; | |
1351 | #endif /* NSAPI_VERSION >= 303 */ | |
1352 | #endif /* INTNSAPI */ | |
1353 | ||
1354 | #else /* !XP_WIN32 */ | |
1355 | ||
1356 | ||
1357 | #endif /* XP_WIN32 */ | |
1358 | ||
1359 | #ifdef __cplusplus | |
1360 | } | |
1361 | #endif | |
1362 | ||
1363 | #endif /* !PUBLIC_NSAPI_H */ |