Annotation of parser3/src/targets/apache13/mod_parser3.C, revision 1.22
1.1 parser 1: /** @file
2: Parser: apache 1.3 module.
3:
1.16 paf 4: Copyright (c) 2001, 2002 ArtLebedev Group (http://www.artlebedev.com)
1.17 paf 5: Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
1.1 parser 6:
1.22 ! paf 7: $Id: mod_parser3.C,v 1.21 2002/06/11 12:20:42 paf Exp $
1.1 parser 8: */
9:
1.18 paf 10: #include "pa_config_includes.h"
11:
12: #if _MSC_VER
13: # include <new.h>
14: #endif
15:
16: #include "pa_globals.h"
17:
1.1 parser 18: #include "httpd.h"
19: #include "http_config.h"
20: #include "http_core.h"
21: #include "http_log.h"
22: #include "http_main.h"
23: #include "http_protocol.h"
24: #include "util_script.h"
25:
1.18 paf 26: #include "pa_common.h"
1.1 parser 27: #include "pa_sapi.h"
28: #include "classes.h"
29: #include "pa_request.h"
30: #include "pa_version.h"
31: #include "pa_socks.h"
32:
1.2 parser 33:
1.1 parser 34: // consts
35:
36: extern const char *main_RCSIds[];
37: #ifdef USE_SMTP
38: extern const char *smtp_RCSIds[];
39: #endif
40: extern const char *gd_RCSIds[];
41: extern const char *classes_RCSIds[];
42: extern const char *types_RCSIds[];
43: extern const char *ApacheModuleParser3_RCSIds[];
44: const char **RCSIds[]={
45: main_RCSIds,
46: #ifdef USE_SMTP
47: smtp_RCSIds,
48: #endif
49: gd_RCSIds,
50: classes_RCSIds,
51: types_RCSIds,
52: ApacheModuleParser3_RCSIds,
53: 0
54: };
55:
56:
57: /// apache parser module configuration [httpd.conf + .htaccess-es]
58: struct Parser_module_config {
1.22 ! paf 59: const char* parser_config_filespec; ///< filespec of site's config file
1.9 paf 60: bool parser_status_allowed;
1.1 parser 61: };
62:
63: /*
64: * Declare ourselves so the configuration routines can find and know us.
65: * We'll fill it in at the end of the module.
66: */
1.9 paf 67: extern "C" module MODULE_VAR_EXPORT parser3_module;
1.1 parser 68:
69: /*
70: * Locate our directory configuration record for the current request.
71: */
72: static Parser_module_config *our_dconfig(request_rec *r) {
73: return (Parser_module_config *)
1.9 paf 74: ap_get_module_config(r->per_dir_config, &parser3_module);
1.1 parser 75: }
76:
77: static const char *cmd_parser_config(cmd_parms *cmd, void *mconfig, char *file_spec) {
78: Parser_module_config *cfg = (Parser_module_config *) mconfig;
79:
80: // remember assigned filespec into cfg
1.22 ! paf 81: cfg->parser_config_filespec=file_spec;
1.1 parser 82:
83: return NULL;
84: }
1.9 paf 85: static const char *cmd_parser_status_allowed(cmd_parms *cmd, void *mconfig, char *file_spec) {
86: //_asm int 3;
87: Parser_module_config *cfg = (Parser_module_config *) mconfig;
88:
89: cfg->parser_status_allowed=true;
90:
91: return NULL;
92: }
1.1 parser 93:
94:
95: /*--------------------------------------------------------------------------*/
96: /* */
97: /* Now we declare our content handlers, which are invoked when the server */
98: /* encounters a document which our module is supposed to have a chance to */
99: /* see. (See mod_mime's SetHandler and AddHandler directives, and the */
100: /* mod_info and mod_status examples, for more details.) */
101: /* */
102: /* Since content handlers are dumping data directly into the connexion */
103: /* (using the r*() routines, such as rputs() and rprintf()) without */
104: /* intervention by other parts of the server, they need to make */
105: /* sure any accumulated HTTP headers are sent first. This is done by */
106: /* calling send_http_header(). Otherwise, no header will be sent at all, */
107: /* and the output sent to the client will actually be HTTP-uncompliant. */
108: /*--------------------------------------------------------------------------*/
109: /*
110: * Sample content handler. All this does is display the call list that has
111: * been built up so far.
112: *
113: * The return value instructs the caller concerning what happened and what to
114: * do next:
115: * OK ("we did our thing")
116: * DECLINED ("this isn't something with which we want to get involved")
117: * HTTP_mumble ("an error status should be reported")
118: */
119:
120:
121: //@{
122: /// SAPI func decl
123: void SAPI::log(Pool& pool, const char *fmt, ...) {
1.4 parser 124: request_rec *r=static_cast<request_rec *>(pool.get_context());
1.1 parser 125:
126: va_list args;
127: va_start(args,fmt);
128: char buf[MAX_STRING];
129: size_t size=vsnprintf(buf, MAX_STRING, fmt, args);
130: remove_crlf(buf, buf+size);
131: ap_log_rerror(0, 0, APLOG_ERR | APLOG_NOERRNO, r, "%s", buf);
132: va_end(args);
133: }
134:
1.7 parser 135: void SAPI::die(const char *fmt, ...) {
136: va_list args;
137: va_start(args,fmt);
138: char buf[MAX_STRING];
139: size_t size=vsnprintf(buf, MAX_STRING, fmt, args);
140: remove_crlf(buf, buf+size);
141: ap_log_error(APLOG_MARK, APLOG_EMERG, 0, "%s", buf);
142: va_end(args);
143:
144: exit(1);
145: }
146:
1.1 parser 147: const char *SAPI::get_env(Pool& pool, const char *name) {
1.4 parser 148: request_rec *r=static_cast<request_rec *>(pool.get_context());
1.1 parser 149: return (const char *)ap_table_get(r->subprocess_env, name);
150: }
151:
1.21 paf 152: #ifndef DOXYGEN
153: struct SAPI_environment_append_info {
154: Pool *pool;
155: const char **cur;
156: };
157: #endif
158: static const char *mk_env_pair(Pool& pool, const char *key, const char *value) {
159: char *result=(char *)pool.malloc(strlen(key)+1/*=*/+strlen(value)+1/*0*/);
160: strcpy(result, key); strcat(result, "="); strcat(result, value);
161: return result;
162: }
163: static int SAPI_environment_append(void *d, const char *k, const char *val) {
164: if( k && val ) {
165: SAPI_environment_append_info& info=
166: *static_cast<SAPI_environment_append_info *>(d);
167: *info.cur++=mk_env_pair(*info.pool, k, val);
168: }
169: return 1/*true*/;
170: }
171: const char *const *SAPI::environment(Pool& pool) {
172: request_rec *r=static_cast<request_rec *>(pool.get_context());
173: const table *t=r->subprocess_env;
174: const char **result=
175: (const char **)pool.malloc(sizeof(char *)*(ap_table_elts(t)->nelts+1/*0*/));
176: SAPI_environment_append_info info={&pool, result};
177: ap_table_do(SAPI_environment_append, &info, t, 0); *info.cur=0; // mark EOE
178: return result;
179: }
180:
1.1 parser 181: size_t SAPI::read_post(Pool& pool, char *buf, size_t max_bytes) {
1.4 parser 182: request_rec *r=static_cast<request_rec *>(pool.get_context());
1.1 parser 183:
184: /* ap_log_error(APLOG_MARK, APLOG_DEBUG, r->server,
185: "mod_parser3: SAPI::read_post(max=%u)", max_bytes);
186: */
187: int retval;
188: if((retval = ap_setup_client_block(r, REQUEST_CHUNKED_ERROR)))
189: return 0;
190: if(!ap_should_client_block(r))
191: return 0;
192:
193: uint total_read_bytes=0;
194: void (*handler)(int)=signal(SIGPIPE, SIG_IGN);
195: while (total_read_bytes<max_bytes) {
196: ap_hard_timeout("Read POST information", r); /* start timeout timer */
197: uint read_bytes=
198: ap_get_client_block(r, buf+total_read_bytes, max_bytes-total_read_bytes);
199: ap_reset_timeout(r);
200: if (read_bytes<=0)
201: break;
202: total_read_bytes+=read_bytes;
203: }
204: signal(SIGPIPE, handler);
205: return total_read_bytes;
206: }
207:
1.15 paf 208: /// @test location provide with protocol. think about internal redirects
1.1 parser 209: void SAPI::add_header_attribute(Pool& pool, const char *key, const char *value) {
1.4 parser 210: request_rec *r=static_cast<request_rec *>(pool.get_context());
1.1 parser 211:
212: if(strcasecmp(key, "location")==0)
213: r->status=302;
214:
215: if(strcasecmp(key, "content-type")==0) {
216: /* r->content_type, *not* r->headers_out("Content-type"). If you don't
217: * set it, it will be filled in with the server's default type (typically
218: * "text/plain"). You *must* also ensure that r->content_type is lower
219: * case.
220: */
221: r->content_type = value;
222: } else if(strcasecmp(key, "status")==0)
223: r->status=atoi(value);
224: else
225: ap_table_addn(r->headers_out, key, value);
226: }
227:
228: void SAPI::send_header(Pool& pool) {
1.4 parser 229: request_rec *r=static_cast<request_rec *>(pool.get_context());
1.1 parser 230:
231: ap_hard_timeout("Send header", r);
232: ap_send_http_header(r);
233: ap_kill_timeout(r);
234: }
235:
236: void SAPI::send_body(Pool& pool, const void *buf, size_t size) {
1.4 parser 237: request_rec *r=static_cast<request_rec *>(pool.get_context());
1.1 parser 238:
239: ap_hard_timeout("Send body", r);
240: ap_rwrite(buf, size, r);
241: ap_kill_timeout(r);
242: }
243:
244: //@}
245:
246: /**
247: main workhorse
248:
249: @todo intelligent cache-control
250: */
1.3 parser 251: static void real_parser_handler(Pool& pool, request_rec *r) {
252: ap_add_common_vars(r);
253: ap_add_cgi_vars(r);
254:
255: // Request info
256: Request::Info request_info;
257: request_info.document_root=SAPI::get_env(pool, "DOCUMENT_ROOT");
258: request_info.path_translated=r->filename;
259: request_info.method=r->method;
260: request_info.query_string=r->args;
261: request_info.uri=SAPI::get_env(pool, "REQUEST_URI");
262: request_info.content_type=SAPI::get_env(pool, "CONTENT_TYPE");
263: const char *content_length=SAPI::get_env(pool, "CONTENT_LENGTH");
264: request_info.content_length=content_length?atoi(content_length):0;
265: request_info.cookie=SAPI::get_env(pool, "HTTP_COOKIE");
266:
1.9 paf 267: // config
268: Parser_module_config *dcfg=our_dconfig(r);
269:
1.3 parser 270: //_asm int 3;
271: // prepare to process request
272: Request request(pool,
273: request_info,
1.12 paf 274: String::UL_HTML|String::UL_OPTIMIZE_BIT,
1.9 paf 275: dcfg->parser_status_allowed
1.3 parser 276: );
277:
278: // process the request
279: request.core(
1.22 ! paf 280: dcfg->parser_config_filespec, true, // /path/to/config
1.3 parser 281: r->header_only!=0);
282: }
283:
284: void call_real_parser_handler__do_SEH(Pool& pool, request_rec *r) {
1.5 parser 285: #if _MSC_VER & !defined(_DEBUG)
1.3 parser 286: LPEXCEPTION_POINTERS system_exception=0;
287: __try {
288: #endif
289: real_parser_handler(pool, r);
290:
1.5 parser 291: #if _MSC_VER & !defined(_DEBUG)
1.3 parser 292: } __except (
293: (system_exception=GetExceptionInformation()),
294: EXCEPTION_EXECUTE_HANDLER) {
295:
296: if(system_exception)
297: if(_EXCEPTION_RECORD *er=system_exception->ExceptionRecord)
1.19 paf 298: throw Exception(0,
1.5 parser 299: 0,
300: "Exception 0x%08X at 0x%08X", er->ExceptionCode, er->ExceptionAddress);
1.3 parser 301: else
1.19 paf 302: throw Exception(0, 0, "Exception <no exception record>");
1.3 parser 303: else
1.19 paf 304: throw Exception(0, 0, "Exception <no exception information>");
1.3 parser 305: }
306: #endif
307: }
308:
1.15 paf 309: /// @test r->finfo.st_mode check seems to work only on win32
1.1 parser 310: static int parser_handler(request_rec *r) {
1.6 parser 311: //_asm int 3;
1.1 parser 312: if(r->finfo.st_mode == 0)
313: return NOT_FOUND;
314:
315: Pool pool(r->pool);
316: pool.set_context(r);
317:
318: /* A flag which modules can set, to indicate that the data being
319: * returned is volatile, and clients should be told not to cache it.
320: */
1.14 paf 321: // r->no_cache=1;
1.1 parser 322:
1.3 parser 323: try { // global try
324: call_real_parser_handler__do_SEH(pool, r);
1.1 parser 325: // successful finish
1.3 parser 326: } catch(const Exception& e) { // global problem
1.1 parser 327: // don't allocate anything on pool here:
328: // possible pool' exception not catch-ed now
329: // and there could be out-of-memory exception
330: const char *body=e.comment();
331: // log it
332: SAPI::log(pool, "exception in request exception handler: %s", body);
333:
334: //
335: int content_length=strlen(body);
336:
337: // prepare header
338: SAPI::add_header_attribute(pool, "content-type", "text/plain");
339: char content_length_cstr[MAX_NUMBER];
340: snprintf(content_length_cstr, MAX_NUMBER, "%u", content_length);
341: SAPI::add_header_attribute(pool, "content-length", content_length_cstr);
342:
343: // send header
344: SAPI::send_header(pool);
345:
346: // send body
347: if(!r->header_only)
348: SAPI::send_body(pool, body, content_length);
349:
350: // unsuccessful finish
351: }
352:
353: /*
354: * We did what we wanted to do, so tell the rest of the server we
355: * succeeded.
356: */
357: return OK;
358: }
359:
1.11 paf 360: #if _MSC_VER
1.10 paf 361: int failed_new(size_t size) {
362: SAPI::die("out of memory in 'new', failed to allocated %u bytes", size);
363: return 0; // not reached
364: }
365: #endif
366:
367: #ifdef HAVE_SET_NEW_HANDLER
368: void failed_new() {
369: SAPI::die("out of memory in 'new'");
370: }
371: #endif
372:
1.1 parser 373: /*--------------------------------------------------------------------------*/
374: /* */
375: /* Now let's declare routines for each of the callback phase in order. */
376: /* (That's the order in which they're listed in the callback list, *not */
377: /* the order in which the server calls them! See the command_rec */
378: /* declaration near the bottom of this file.) Note that these may be */
379: /* called for situations that don't relate primarily to our function - in */
380: /* other words, the fixup handler shouldn't assume that the request has */
381: /* to do with "example" stuff. */
382: /* */
383: /* With the exception of the content handler, all of our routines will be */
384: /* called for each request, unless an earlier handler from another module */
385: /* aborted the sequence. */
386: /* */
387: /* Handlers that are declared as "int" can return the following: */
388: /* */
389: /* OK Handler accepted the request and did its thing with it. */
390: /* DECLINED Handler took no action. */
391: /* HTTP_mumble Handler looked at request and found it wanting. */
392: /* */
393: /* What the server does after calling a module handler depends upon the */
394: /* handler's return value. In all cases, if the handler returns */
395: /* DECLINED, the server will continue to the next module with an handler */
396: /* for the current phase. However, if the handler return a non-OK, */
397: /* non-DECLINED status, the server aborts the request right there. If */
398: /* the handler returns OK, the server's next action is phase-specific; */
399: /* see the individual handler comments below for details. */
400: /* */
401: /*--------------------------------------------------------------------------*/
402: /*
403: * This function is called during server initialisation. Any information
404: * that needs to be recorded must be in static cells, since there's no
405: * configuration record.
406: *
407: * There is no return value.
408: */
409:
410: static void setup_module_cells() {
411: static bool globals_inited=false;
412: if(globals_inited)
413: return;
414: globals_inited=true;
1.10 paf 415:
416: #ifdef WIN32
417: _set_new_handler(failed_new);
418: #endif
419:
420: #ifdef HAVE_SET_NEW_HANDLER
421: std::set_new_handler(failed_new);
422: #endif
1.1 parser 423:
424: /*
425: * allocate our module-private pool.
426: */
427: static Pool pool(ap_make_sub_pool(NULL)); // global pool
1.3 parser 428: /// no trying to __try here [yet]
429: try {
1.1 parser 430: // init socks
431: init_socks(pool);
432:
433: // init global classes
434: init_methoded_array(pool);
435: // init global variables
436: pa_globals_init(pool);
1.3 parser 437: } catch(const Exception& e) { // global problem
1.7 parser 438: SAPI::die("setup_module_cells failed: %s", e.comment());
1.1 parser 439: }
440: }
441:
442: static void parser_server_init(server_rec *s, pool *p) {
443: #if MODULE_MAGIC_NUMBER >= 19980527
444: ap_add_version_component("Parser/"PARSER_VERSION);
445: #endif
446:
447: /*
448: * Set up any module cells that ought to be initialised.
449: */
450: setup_module_cells();
451: }
452:
453: /*
454: * This function gets called to create a per-directory configuration
455: * record. This will be called for the "default" server environment, and for
456: * each directory for which the parser finds any of our directives applicable.
457: * If a directory doesn't have any of our directives involved (i.e., they
458: * aren't in the .htaccess file, or a <Location>, <Directory>, or related
459: * block), this routine will *not* be called - the configuration for the
460: * closest ancestor is used.
461: *
462: * The return value is a pointer to the created module-specific
463: * structure.
464: */
465: static void *parser_create_dir_config(pool *p, char *dirspec) {
1.13 paf 466: //_asm int 3;
1.1 parser 467: /*
468: * Allocate the space for our record from the pool supplied.
469: */
470: Parser_module_config *cfg=
471: (Parser_module_config *) ap_pcalloc(p, sizeof(Parser_module_config));
472: /*
473: * Now fill in the defaults. If there are any `parent' configuration
474: * records, they'll get merged as part of a separate callback.
475: */
1.9 paf 476:
1.1 parser 477: return (void *) cfg;
478: }
479:
480: /*
481: * This function gets called to merge two per-directory configuration
482: * records. This is typically done to cope with things like .htaccess files
483: * or <Location> directives for directories that are beneath one for which a
484: * configuration record was already created. The routine has the
485: * responsibility of creating a new record and merging the contents of the
486: * other two into it appropriately. If the module doesn't declare a merge
487: * routine, the record for the closest ancestor location (that has one) is
488: * used exclusively.
489: *
490: * The routine MUST NOT modify any of its arguments!
491: *
492: * The return value is a pointer to the created module-specific structure
493: * containing the merged values.
1.13 paf 494:
495: 20011126 paf: noticed, that this is called even on virtual root merge with something "parent",
496: while thought that that is part of merge_server...
497:
1.1 parser 498: */
499: static void *parser_merge_dir_config(pool *p, void *parent_conf,
500: void *newloc_conf) {
1.13 paf 501: //_asm int 3;
1.1 parser 502: Parser_module_config *merged_config =
503: (Parser_module_config *) ap_pcalloc(p, sizeof(Parser_module_config));
504: Parser_module_config *pconf = (Parser_module_config *) parent_conf;
505: Parser_module_config *nconf = (Parser_module_config *) newloc_conf;
506:
1.22 ! paf 507: merged_config->parser_config_filespec = ap_pstrdup(p, nconf->parser_config_filespec?
! 508: nconf->parser_config_filespec:pconf->parser_config_filespec);
1.9 paf 509: merged_config->parser_status_allowed=
510: pconf->parser_status_allowed ||
511: nconf->parser_status_allowed;
1.13 paf 512:
513: /*
1.1 parser 514: * Some things get copied directly from the more-specific record, rather
515: * than getting merged.
516: */
517:
518: return (void *) merged_config;
519: }
520:
521: /*
522: * This function gets called to create a per-server configuration
523: * record. It will always be called for the "default" server.
524: *
525: * The return value is a pointer to the created module-specific
526: * structure.
527: */
528: static void *parser_create_server_config(pool *p, server_rec *s) {
1.13 paf 529: //_asm int 3;
1.1 parser 530: /*
1.13 paf 531: * As with the parser_create_dir_config() routine, we allocate and fill
1.1 parser 532: * in an empty record.
533: */
534: Parser_module_config *cfg=
535: (Parser_module_config *) ap_pcalloc(p, sizeof(Parser_module_config));
536:
537: return (void *) cfg;
538: }
539:
540: /*
541: * This function gets called to merge two per-server configuration
542: * records. This is typically done to cope with things like virtual hosts and
543: * the default server configuration The routine has the responsibility of
544: * creating a new record and merging the contents of the other two into it
545: * appropriately. If the module doesn't declare a merge routine, the more
546: * specific existing record is used exclusively.
547: *
548: * The routine MUST NOT modify any of its arguments!
549: *
550: * The return value is a pointer to the created module-specific structure
551: * containing the merged values.
552: */
553: static void *parser_merge_server_config(pool *p, void *server1_conf,
554: void *server2_conf)
555: {
1.13 paf 556: //_asm int 3;
1.1 parser 557:
558: Parser_module_config *merged_config =
559: (Parser_module_config *) ap_pcalloc(p, sizeof(Parser_module_config));
560: Parser_module_config *s1conf = (Parser_module_config *) server1_conf;
561: Parser_module_config *s2conf = (Parser_module_config *) server2_conf;
562:
563: /*
564: * Our inheritance rules are our own, and part of our module's semantics.
565: * Basically, just note whence we came.
566: */
1.22 ! paf 567: merged_config->parser_config_filespec = ap_pstrdup(p, s2conf->parser_config_filespec?
! 568: s2conf->parser_config_filespec:s1conf->parser_config_filespec);
1.9 paf 569: merged_config->parser_status_allowed=
570: s1conf->parser_status_allowed ||
571: s2conf->parser_status_allowed;
1.1 parser 572:
573: return (void *) merged_config;
574: }
575:
576: /*
577: * This routine gives our module an opportunity to translate the URI into an
578: * actual filename. If we don't do anything special, the server's default
579: * rules (Alias directives and the like) will continue to be followed.
580: *
581: * The return value is OK, DECLINED, or HTTP_mumble. If we return OK, no
582: * further modules are called for this phase.
583: */
584: static int parser_translate_handler(request_rec *r) {
585: Parser_module_config *cfg=our_dconfig(r);
586: return DECLINED;
587: }
588:
589: /*
590: * This routine is called to check the authentication information sent with
591: * the request (such as looking up the user in a database and verifying that
592: * the [encrypted] password sent matches the one in the database).
593: *
594: * The return value is OK, DECLINED, or some HTTP_mumble error (typically
595: * HTTP_UNAUTHORIZED). If we return OK, no other modules are given a chance
596: * at the request during this phase.
597: */
598: static int parser_check_user_id(request_rec *r) {
599: Parser_module_config *cfg=our_dconfig(r);
600: return DECLINED;
601: }
602:
603: /*
604: * This routine is called to check to see if the resource being requested
605: * requires authorisation.
606: *
607: * The return value is OK, DECLINED, or HTTP_mumble. If we return OK, no
608: * other modules are called during this phase.
609: *
610: * If *all* modules return DECLINED, the request is aborted with a server
611: * error.
612: */
613: static int parser_auth_checker(request_rec *r) {
614: Parser_module_config *cfg=our_dconfig(r);
615: return DECLINED;
616: }
617:
618: /*
619: * This routine is called to check for any module-specific restrictions placed
620: * upon the requested resource. (See the mod_access module for an example.)
621: *
622: * The return value is OK, DECLINED, or HTTP_mumble. All modules with an
623: * handler for this phase are called regardless of whether their predecessors
624: * return OK or DECLINED. The first one to return any other status, however,
625: * will abort the sequence (and the request) as usual.
626: */
627: static int parser_access_checker(request_rec *r) {
628:
629: Parser_module_config *cfg=our_dconfig(r);
630: return DECLINED;
631: }
632:
633: /*--------------------------------------------------------------------------*/
634: /* */
635: /* All of the routines have been declared now. Here's the list of */
636: /* directives specific to our module, and information about where they */
637: /* may appear and how the command parser should pass them to us for */
638: /* processing. Note that care must be taken to ensure that there are NO */
639: /* collisions of directive names between modules. */
640: /* */
641: /*--------------------------------------------------------------------------*/
642: /*
643: * List of directives specific to our module.
644: */
645: static const command_rec parser_cmds[] =
646: {
647: {
1.22 ! paf 648: "ParserConfig", /* directive name */
1.1 parser 649: (const char *(*)(void))((void *)cmd_parser_config), // config action routine
1.22 ! paf 650: (void*)0, /* argument to include in call */
1.1 parser 651: (int)(OR_OPTIONS), /* where available */
652: TAKE1, /* arguments */
653: "Parser site config filespec" // directive description
654: },
1.9 paf 655: {
656: "ParserStatusAllowed", /* directive name */
657: (const char *(*)(void))((void *)cmd_parser_status_allowed), // config action routine
658: (void*)0, /* argument to include in call */
659: (int)(ACCESS_CONF), /* where available */
660: NO_ARGS, /* arguments */
661: "Parser status class can be used" // directive description
662: },
1.1 parser 663: {NULL}
664: };
665:
666: /*--------------------------------------------------------------------------*/
667: /* */
668: /* Now the list of content handlers available from this module. */
669: /* */
670: /*--------------------------------------------------------------------------*/
671: /*
672: * List of content handlers our module supplies. Each handler is defined by
673: * two parts: a name by which it can be referenced (such as by
674: * {Add,Set}Handler), and the actual routine name. The list is terminated by
675: * a NULL block, since it can be of variable length.
676: *
677: * Note that content-handlers are invoked on a most-specific to least-specific
678: * basis; that is, a handler that is declared for "text/plain" will be
679: * invoked before one that was declared for "text / *". Note also that
680: * if a content-handler returns anything except DECLINED, no other
681: * content-handlers will be called.
682: */
683: static const handler_rec parser_handlers[] =
684: {
1.9 paf 685: {"parser3-handler", parser_handler},
1.1 parser 686: {NULL}
687: };
688:
689: /*--------------------------------------------------------------------------*/
690: /* */
691: /* Finally, the list of callback routines and data structures that */
692: /* provide the hooks into our module from the other parts of the server. */
693: /* */
694: /*--------------------------------------------------------------------------*/
695: /*
696: * Module definition for configuration. If a particular callback is not
697: * needed, replace its routine name below with the word NULL.
698: *
699: * The number in brackets indicates the order in which the routine is called
700: * during request processing. Note that not all routines are necessarily
701: * called (such as if a resource doesn't have access restrictions).
702: */
1.9 paf 703: module MODULE_VAR_EXPORT parser3_module =
1.1 parser 704: {
705: STANDARD_MODULE_STUFF,
706: parser_server_init, /* module initializer */
707: parser_create_dir_config, /* per-directory config creator */
708: parser_merge_dir_config, /* dir config merger */
709: parser_create_server_config, /* server config creator */
710: parser_merge_server_config, /* server config merger */
711: parser_cmds, /* command table */
712: parser_handlers, /* [9] list of handlers */
713: parser_translate_handler, /* [2] filename-to-URI translation */
714: parser_check_user_id, /* [5] check/validate user_id */
715: parser_auth_checker, /* [6] check user_id is valid *here* */
716: parser_access_checker, /* [4] check access by host address */
717: 0, /* [7] MIME type checker/setter */
718: 0, /* [8] fixups */
719: 0 /* [10] logger */
720: };
721:
722: #if defined(_MSC_VER)
1.20 paf 723: # define APACHE_WIN32_SRC "/parser3project/win32/apache13/src"
1.1 parser 724: # ifdef _DEBUG
725: # pragma comment(lib, APACHE_WIN32_SRC "/CoreD/ApacheCore.lib")
726: # else
727: # pragma comment(lib, APACHE_WIN32_SRC "/CoreR/ApacheCore.lib")
728: # endif
729: #endif
E-mail: