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