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