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