--- parser3/src/targets/apache/mod_parser3.c 2010/11/23 00:00:32 1.8 +++ parser3/src/targets/apache/mod_parser3.c 2012/04/18 13:34:39 1.13 @@ -1,12 +1,10 @@ /** @file Parser: apache 1.3 and 2.2 module - Copyright (c) 2001-2010 ArtLebedev Group (http://www.artlebedev.com) + Copyright (c) 2001-2012 Art. Lebedev Studio (http://www.artlebedev.com) Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char * const IDENT_MOD_PARSER3_C="$Date: 2010/11/23 00:00:32 $"; - #ifdef WIN32 #include #endif @@ -21,6 +19,8 @@ static const char * const IDENT_MOD_PARS #include "pa_httpd.h" +volatile const char * IDENT_MOD_PARSER3_C="$Id: mod_parser3.c,v 1.13 2012/04/18 13:34:39 moko Exp $" IDENT_PA_HTTPD_H; + #define PARSER3_HANDLER "parser3-handler" /* @@ -65,7 +65,7 @@ static Parser_module_config *our_dconfig return (Parser_module_config *) ap_get_module_config(r->per_dir_config, &parser3_module); } -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, const char *file_spec) { Parser_module_config *cfg = (Parser_module_config *) mconfig; cfg->parser_config_filespec=file_spec; return NULL; @@ -80,6 +80,10 @@ static int parser_handler(request_rec *r if(strcmp(r->handler, PARSER3_HANDLER)) return DECLINED; #endif + + // we setup module here to avoid GPF on init with php5-xsl installed + pa_setup_module_cells(); + // converting to parser version pa_request_rec pr={ r, @@ -108,12 +112,11 @@ static int parser_handler(request_rec *r */ #ifdef STANDARD20_MODULE_STUFF -static void parser_module_init(apr_pool_t *p, server_rec *s) { +static void parser_child_init(apr_pool_t *p, server_rec *s) { #else static void parser_module_init(server_rec *s, apr_pool_t *p) { #endif - ap_log_perror(APLOG_MARK, APLOG_EMERG, 0, p, "parser inited %d", getpid()); - pa_setup_module_cells(); +// ap_log_perror(APLOG_MARK, APLOG_EMERG, 0, p, "parser inited %d", getpid()); } /* @@ -146,14 +149,7 @@ static void *parser_create_server_config */ static const command_rec parser_cmds[] = { - { - "ParserConfig", /* directive name */ - (const char* (*)(void))((void *)cmd_parser_config), // config action routine - (void*)0, /* argument to include in call */ - (int)(OR_OPTIONS), /* where available */ - TAKE1, /* arguments */ - "Parser config filespec" // directive description - }, + {"ParserConfig", (const char *(*)())cmd_parser_config, 0, OR_OPTIONS, TAKE1, "Parser config filespec"}, {NULL} }; @@ -181,9 +177,8 @@ static const handler_rec parser_handlers */ static void parser_register_hooks(apr_pool_t* pool) { -// ap_hook_post_config(parser_server_init, 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_child_init, NULL, NULL, APR_HOOK_MIDDLE); }; module AP_MODULE_DECLARE_DATA parser3_module = @@ -238,9 +233,9 @@ void pa_ap_log_rerror(const char *file, ap_log_rerror(file, line, level, #ifdef STANDARD20_MODULE_STUFF - 0, + 0, #endif - (request_rec*)s->real_request_rec, "%s", str); + (request_rec*)s->real_request_rec, "%s", str); } @@ -253,9 +248,9 @@ void pa_ap_log_error(const char *file, i ap_log_error(file, line, level, #ifdef STANDARD20_MODULE_STUFF - 0, + 0, #endif - (server_rec*)s, "%s", str); + (server_rec*)s, "%s", str); } // ap_alloc.h @@ -307,7 +302,7 @@ int pa_ap_rwrite(const void *buf, int nb void pa_ap_hard_timeout(const char *s, pa_request_rec *r) { // Apache 2 uses non-blocking I/O #ifndef STANDARD20_MODULE_STUFF - ap_hard_timeout(s, (request_rec*)r->real_request_rec); + ap_hard_timeout((char *)s, (request_rec*)r->real_request_rec); #endif } void pa_ap_reset_timeout(pa_request_rec *r) {