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

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

E-mail: