Diff for /parser3/src/targets/apache/mod_parser3.c between versions 1.5 and 1.8

version 1.5, 2010/11/16 00:43:19 version 1.8, 2010/11/23 00:00:32
Line 45  static const char * const IDENT_MOD_PARS Line 45  static const char * const IDENT_MOD_PARS
 #define apr_pool_t pool  #define apr_pool_t pool
 #define apr_table_t table  #define apr_table_t table
   
 #define ap_add_version_component(p, v) ap_add_version_component(v)   
   
 #endif /* STANDARD20_MODULE_STUFF */  #endif /* STANDARD20_MODULE_STUFF */
   
 /*  /*
Line 69  static Parser_module_config *our_dconfig Line 67  static Parser_module_config *our_dconfig
   
 static const char* cmd_parser_config(cmd_parms *cmd, void *mconfig, char *file_spec) {  static const char* cmd_parser_config(cmd_parms *cmd, void *mconfig, char *file_spec) {
         Parser_module_config *cfg = (Parser_module_config *) mconfig;          Parser_module_config *cfg = (Parser_module_config *) mconfig;
           
         // remember assigned filespec into cfg  
         cfg->parser_config_filespec=file_spec;          cfg->parser_config_filespec=file_spec;
           
         return NULL;  
 }  
   
 static const char* cmd_parser_status_allowed(cmd_parms *cmd, void *mconfig, char *file_spec) {  
         Parser_module_config *cfg = (Parser_module_config *) mconfig;  
           
         cfg->parser_status_allowed=1;  
           
         return NULL;          return NULL;
 }  }
   
Line 89  static const char* cmd_parser_status_all Line 76  static const char* cmd_parser_status_all
 */  */
   
 static int parser_handler(request_rec *r) {  static int parser_handler(request_rec *r) {
   
 //      ap_log_rerror(APLOG_MARK, APLOG_EMERG, 0, r, "handler, r->handler=%s", r->handler);  
   
 #ifdef STANDARD20_MODULE_STUFF  #ifdef STANDARD20_MODULE_STUFF
         if(strcmp(r->handler, PARSER3_HANDLER))          if(strcmp(r->handler, PARSER3_HANDLER))
                 return DECLINED;                  return DECLINED;
Line 116  static int parser_handler(request_rec *r Line 100  static int parser_handler(request_rec *r
                 r->finfo.st_mode == 0                  r->finfo.st_mode == 0
 #endif  #endif
         };          };
           return pa_parser_handler(&pr, our_dconfig(r));
         // config  
         Parser_module_config *dcfg=our_dconfig(r);  
   
         return pa_parser_handler(&pr, dcfg);  
 }  }
   
 /*   /* 
Line 131  static int parser_handler(request_rec *r Line 111  static int parser_handler(request_rec *r
 static void parser_module_init(apr_pool_t *p, server_rec *s) {  static void parser_module_init(apr_pool_t *p, server_rec *s) {
 #else  #else
 static void parser_module_init(server_rec *s, apr_pool_t *p) {  static void parser_module_init(server_rec *s, apr_pool_t *p) {
         ap_add_version_component(p, pa_version());  
 #endif    #endif  
         ap_log_perror(APLOG_MARK, APLOG_EMERG, 0, p, "parser inited %d", getpid());          ap_log_perror(APLOG_MARK, APLOG_EMERG, 0, p, "parser inited %d", getpid());
         pa_setup_module_cells();          pa_setup_module_cells();
Line 148  static void parser_module_done(server_re Line 127  static void parser_module_done(server_re
 * This function gets called to create a per-directory configuration record.  * This function gets called to create a per-directory configuration record.
 */  */
 static void *parser_create_dir_config(apr_pool_t *p, char *dirspec) {  static void *parser_create_dir_config(apr_pool_t *p, char *dirspec) {
         /*          Parser_module_config *cfg= ap_pcalloc(p, sizeof(Parser_module_config));
         * Allocate the space for our record from the apr_pool_t supplied.          cfg->parser_config_filespec=NULL;
         */          return cfg;
         Parser_module_config *cfg= (Parser_module_config *) ap_pcalloc(p, sizeof(Parser_module_config));  
         return (void *) cfg;  
 }  
   
 /*  
 * This function gets called to merge two per-directory configuration records.  
 *  
 * 20011126 paf: noticed, that this is called even on virtual root merge with something "parent",  
 * while thought that that is part of merge_server...  
 *  
 */  
 static void *parser_merge_dir_config(apr_pool_t *p, void *parent_conf, void *newloc_conf) {  
         Parser_module_config *merged_config = (Parser_module_config *) ap_pcalloc(p, sizeof(Parser_module_config));  
         Parser_module_config *pconf = (Parser_module_config *) parent_conf;  
         Parser_module_config *nconf = (Parser_module_config *) newloc_conf;  
           
         merged_config->parser_config_filespec = ap_pstrdup(p, nconf->parser_config_filespec?  
                 nconf->parser_config_filespec:pconf->parser_config_filespec);  
         merged_config->parser_status_allowed= pconf->parser_status_allowed || nconf->parser_status_allowed;  
           
         return (void *) merged_config;  
 }  }
   
 /*  /*
 * This function gets called to create a per-server configuration record.  * This function gets called to create a per-server configuration record.
 */  */
 static void *parser_create_server_config(apr_pool_t *p, server_rec *s) {  static void *parser_create_server_config(apr_pool_t *p, server_rec *s) {
         /*          Parser_module_config *cfg= ap_pcalloc(p, sizeof(Parser_module_config));
         * As with the parser_create_dir_config() routine, we allocate and fill          cfg->parser_config_filespec=NULL;
         * in an empty record.          return cfg;
         */  
         Parser_module_config *cfg= (Parser_module_config *) ap_pcalloc(p, sizeof(Parser_module_config));  
           
         return (void *) cfg;  
 }  
   
 /*  
 * This function gets called to merge two per-server configuration records.  
 */  
 static void *parser_merge_server_config(apr_pool_t *p, void *server1_conf, void *server2_conf)  
 {  
         Parser_module_config *merged_config = (Parser_module_config *) ap_pcalloc(p, sizeof(Parser_module_config));  
         Parser_module_config *s1conf = (Parser_module_config *) server1_conf;  
         Parser_module_config *s2conf = (Parser_module_config *) server2_conf;  
           
         /*  
         * Our inheritance rules are our own, and part of our module's semantics.  
         * Basically, just note whence we came.  
         */  
         merged_config->parser_config_filespec = ap_pstrdup(p, s2conf->parser_config_filespec?  
                 s2conf->parser_config_filespec:s1conf->parser_config_filespec);  
         merged_config->parser_status_allowed= s1conf->parser_status_allowed || s2conf->parser_status_allowed;  
           
         return (void *) merged_config;  
 }  }
   
 /*   /* 
Line 220  static const command_rec parser_cmds[] = Line 154  static const command_rec parser_cmds[] =
                         TAKE1,                          /* arguments */                          TAKE1,                          /* arguments */
                         "Parser config filespec"        // directive description                          "Parser config filespec"        // directive description
         },          },
         {  
                 "ParserStatusAllowed",                  /* directive name */  
                         (const char* (*)(void))((void *)cmd_parser_status_allowed), // config action routine  
                         (void*)0,                       /* argument to include in call */  
                         (int)(ACCESS_CONF),             /* where available */  
                         NO_ARGS,                        /* arguments */  
                         "Parser status class can be used" // directive description  
         },  
         {NULL}          {NULL}
 };  };
   
Line 255  static const handler_rec parser_handlers Line 181  static const handler_rec parser_handlers
 */  */
 static void parser_register_hooks(apr_pool_t* pool)  static void parser_register_hooks(apr_pool_t* pool)
 {  {
 //      ap_add_version_component(pool, pa_version());  
 //      ap_hook_post_config(parser_server_init, NULL, NULL, APR_HOOK_MIDDLE);  //      ap_hook_post_config(parser_server_init, NULL, NULL, APR_HOOK_MIDDLE);
         ap_hook_handler(parser_handler, NULL, NULL, APR_HOOK_MIDDLE);          ap_hook_handler(parser_handler, NULL, NULL, APR_HOOK_MIDDLE);
         ap_hook_child_init(parser_module_init, NULL, NULL, APR_HOOK_MIDDLE);          ap_hook_child_init(parser_module_init, NULL, NULL, APR_HOOK_MIDDLE);
Line 271  module MODULE_VAR_EXPORT parser3_module Line 196  module MODULE_VAR_EXPORT parser3_module
         parser_module_init,             /* module initializer */          parser_module_init,             /* module initializer */
 #endif  #endif
         parser_create_dir_config,       /* per-directory config creator */          parser_create_dir_config,       /* per-directory config creator */
         parser_merge_dir_config,        /* dir config merger */          0,                              /* dir config merger */
         parser_create_server_config,    /* server config creator */          parser_create_server_config,    /* server config creator */
         parser_merge_server_config,     /* server config merger */          0,                              /* server config merger */
         parser_cmds,                    /* command apr_table_t */          parser_cmds,                    /* command apr_table_t */
 #ifdef STANDARD20_MODULE_STUFF  #ifdef STANDARD20_MODULE_STUFF
         parser_register_hooks           /* register hooks */          parser_register_hooks           /* register hooks */
Line 304  module MODULE_VAR_EXPORT parser3_module Line 229  module MODULE_VAR_EXPORT parser3_module
   
 // interface to C++  // interface to C++
   
 #define PA_APLOG_EMERG          0       /* system is unusable */  
 #define PA_APLOG_ALERT          1       /* action must be taken immediately */  
 #define PA_APLOG_CRIT           2       /* critical conditions */  
 #define PA_APLOG_ERR            3       /* error conditions */  
 #define PA_APLOG_WARNING        4       /* warning conditions */  
 #define PA_APLOG_NOTICE         5       /* normal but significant condition */  
 #define PA_APLOG_INFO           6       /* informational */  
 #define PA_APLOG_DEBUG          7       /* debug-level messages */  
   
 #define PA_APLOG_LEVELMASK      7       /* mask off the level value */  
   
 #define PA_APLOG_NOERRNO        (PA_APLOG_LEVELMASK + 1)  
   
 #define PA_APLOG_MARK   __FILE__,__LINE__  
   
 void pa_ap_log_rerror(const char *file, int line, int level, const pa_request_rec *s, const char *fmt, ...) {  void pa_ap_log_rerror(const char *file, int line, int level, const pa_request_rec *s, const char *fmt, ...) {
         const char* str;          const char* str;
         va_list l;          va_list l;
Line 394  int pa_ap_rwrite(const void *buf, int nb Line 304  int pa_ap_rwrite(const void *buf, int nb
   
 // http_main.h  // http_main.h
   
 void pa_ap_hard_timeout(char *s, pa_request_rec *r) {  void pa_ap_hard_timeout(const char *s, pa_request_rec *r) {
 // Apache 2 uses non-blocking I/O  // Apache 2 uses non-blocking I/O
 #ifndef STANDARD20_MODULE_STUFF  #ifndef STANDARD20_MODULE_STUFF
         ap_hard_timeout(s, (request_rec*)r->real_request_rec);          ap_hard_timeout(s, (request_rec*)r->real_request_rec);

Removed from v.1.5  
changed lines
  Added in v.1.8


E-mail: