Annotation of parser3/src/targets/apache13/modules/extra/mod_parser3.C, revision 1.38

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

E-mail: