hey
hello to all.. can anybody guide me how to write a simple apache2 module, which prints the messages through HTTP GET method from client and server. i just want to print all the messages to a text file. with the request ID url, response and method name etc. thanks -- View this message in context: http://old.nabble.com/hey-tp32934901p32934901.html Sent from the Apache HTTP Server - Module Writers mailing list archive at Nabble.com.
MacOSX and per_dir_config
Hi everyone, Am I missing something obvious for modules on MacOSX? The attached simple example of reading the request-per_dir_config works fine on Windows and other Unix platforms but not at all when built for Apache on MacOS X platforms. All this module does is setup a header with the value from a directory configuration parameter, simple enough but doesn't work due to the per_dir_config for the module being always NULL. I compile the example through apxs both for 32 and 64 bit versions of Apache, prebuilt Apache binaries and Apache built from source by me. The result is always the same. To compile for example for 32bit Apache on MacOSX: apxs -i -a -c -Wc,-arch i386 -Wl,-arch i386 testmodule.c Before anyone mentions it, yes I know the example here is incomplete and will make multiple header entries in any number of cases, but thats not the point. Is this a real problem on MacOSX, or am I missing something? :) To test the module just add the following parameter to the default directory configuration of any out-of-the-box Apache 2.2.x with the module installed. DirHeaderName TestingTesting123 /Anthony #include httpd.h #include http_config.h #include http_log.h #include apr_strings.h module AP_MODULE_DECLARE_DATA test_module; /* * Data types for per-directory and per-server configuration */ typedef struct { char *header_name; /* Header Name */ } dir_config_rec; typedef struct { char *header_name; /* Header Name */ } srv_config_rec; static int addHeaders(request_rec *request) { module *m = test_module; dir_config_rec *dir= (dir_config_rec *) ap_get_module_config(request-per_dir_config, test_module); srv_config_rec *srv= (srv_config_rec *) ap_get_module_config(request-server-module_config, test_module); ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL, Module Index (addHeaders): %s - %d, request-uri, m-module_index); apr_table_set(request-headers_out, srv-header_name, Hello, world!); if( dir != NULL ) { apr_table_set(request-headers_out, dir-header_name, Hello, world!); } else { ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL, Per_dir_config for %s was NULL!!!, request-uri); } return OK; } static void reg_hooks(apr_pool_t *p) { ap_hook_fixups(addHeaders, NULL, NULL, APR_HOOK_MIDDLE); } static void *create_dir_config(apr_pool_t *p, char *d) { module *m = test_module; dir_config_rec *dir= (dir_config_rec *) apr_palloc(p, sizeof(dir_config_rec)); dir-header_name = apr_pstrdup(p, X-Dir-Test); ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL, Module Index (create_dir_config): %s - %d, d, m-module_index); return dir; } static void *create_srv_config( apr_pool_t *p, server_rec *s) { srv_config_rec *srv= (srv_config_rec *) apr_palloc(p, sizeof(srv_config_rec)); srv-header_name = apr_pstrdup(p, X-Srv-Test); return (void *)srv; } /* * Config file commands that this module can handle */ static const command_rec setup_cmds[] = { AP_INIT_TAKE1(DirHeaderName, ap_set_string_slot, (void *)APR_OFFSETOF(dir_config_rec, header_name), OR_AUTHCFG, Name of the header in this directory.), { NULL } }; module AP_MODULE_DECLARE_DATA test_module = { STANDARD20_MODULE_STUFF, create_dir_config, /* create per-directory config structures */ NULL, /* merge per-directory config structures */ create_srv_config, /* create per-server config structures */ NULL, /* merge per-server config structures */ setup_cmds, /* command handlers */ reg_hooks /* register hooks */ };
Win :: apr-util-1.4.1
Building out of the box on Windows including apr_crypto_oppenssl. Also apr_crypto_nss compiles fine, but have no nss3.lib here yet, so cannot link now.
Re: Win :: apr-util-1.4.1
On 12/08/2011 01:04 PM, Steffen wrote: Building out of the box on Windows including apr_crypto_oppenssl. Also apr_crypto_nss compiles fine, but have no nss3.lib here yet, so cannot link now. 1. You should use apr developers list http://apr.apache.org/mailing-lists.html 2. Use Mozilla's Xulrunner (Gecko) SDK https://developer.mozilla.org/en/Gecko_SDK Regards -- ^TM
Re: : apr-util-1.4.1 failes with Crypto
Building HTTPD, thanks for the link, rather I build it by myself for Win32 and Win64 with VC9. Have made the libs, build with nss-3.12.7/nspr-4.8.6 Building HTTPD with apr-util 1.4.1 with #define APU-HAVE-CRYPTO = 1 then failed with: \crypto\apr_crypto.c(113) : error C2065: 'params' : undeclared identifier .\crypto\apr_crypto.c(113) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int' .\crypto\apr_crypto.c(113) : warning C4024: 'function through pointer' : different types for formal and actual parameter 2 .\crypto\apr_crypto.c(113) : error C2198: 'function through pointer' : too few arguments for call -Original Message- From: Mladen Turk Sent: Thursday, December 08, 2011 1:49 PM To: dev@httpd.apache.org Subject: Re: Win :: apr-util-1.4.1 On 12/08/2011 01:04 PM, Steffen wrote: Building out of the box on Windows including apr_crypto_oppenssl. Also apr_crypto_nss compiles fine, but have no nss3.lib here yet, so cannot link now. 1. You should use apr developers list http://apr.apache.org/mailing-lists.html 2. Use Mozilla's Xulrunner (Gecko) SDK https://developer.mozilla.org/en/Gecko_SDK Regards -- ^TM
Re: : apr-util-1.4.1 failes with Crypto
On 08 Dec 2011, at 4:13 PM, Steffen wrote: Building HTTPD, thanks for the link, rather I build it by myself for Win32 and Win64 with VC9. Have made the libs, build with nss-3.12.7/nspr-4.8.6 Building HTTPD with apr-util 1.4.1 with #define APU-HAVE-CRYPTO = 1 then failed with: \crypto\apr_crypto.c(113) : error C2065: 'params' : undeclared identifier .\crypto\apr_crypto.c(113) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int' .\crypto\apr_crypto.c(113) : warning C4024: 'function through pointer' : different types for formal and actual parameter 2 .\crypto\apr_crypto.c(113) : error C2198: 'function through pointer' : too few arguments for call What happens when you try and build it dynamically? Regards, Graham --
Re: questions about document_root
On December 8, 2011 1:48 , Rui Hu tchrb...@gmail.com wrote: 2011/12/8 Rui Hu tchrb...@gmail.com mailto:tchrb...@gmail.com Is $DOCUMENT_ROOT in php-cgi determined by ap_add_common_vars() in Apache? It seems not to me. I commented the line 237 assigning DOCUMENT_ROOT and re-compiled apache. php-cgi still works fine. It seems that $DUCUMENT_ROOT in php-cgi is not determined by this function. What you say is correct. This is an Apache HTTP Server mailing list. You said, in apache, I cannot find any code which assign this var. and I showed you where in Apache HTTP Server the DOCUMENT_ROOT environment variable is set when running CGIs. What you are now asking should be sent to the PHP users mailing list, since it is a question about PHP. But, see the function init_request_info() in the PHP source code, in the file sapi/cgi/cgi_main.c (lines 1123-1137) http://svn.php.net/viewvc/php/php-src/branches/PHP_5_3_8/sapi/cgi/cgi_main.c?revision=315335view=markup How PHP determines the value of $_SERVER[DOCUMENT_ROOT] depends on all of the following: - The value for the PHP directive cgi.fix_pathinfo - The value for the PHP directive doc_root - The value of the environment variable DOCUMENT_ROOT (set by Apache HTTP Server) -- Mark Montague m...@catseye.org
Re: : apr-util-1.4.1 failes with Crypto
When APU-HAVE-CRYPTO = 0 and build project seperate it generates fine a apr_crypto_nss-1.dll (dynam) When APU-HAVE-CRYPTO = 1 and build project seperate it fails with: -- Build started: Project: apr_crypto_nss, Configuration: Release Win32 -- Compiling... apr_crypto_nss.c .\apr_crypto_nss.c(33) : fatal error C1083: Cannot open include file: 'prerror.h': No such file or directory -Original Message- From: Graham Leggett Sent: Thursday, December 08, 2011 3:25 PM Newsgroups: gmane.comp.apache.devel To: dev@httpd.apache.org Subject: Re: : apr-util-1.4.1 failes with Crypto On 08 Dec 2011, at 4:13 PM, Steffen wrote: Building HTTPD, thanks for the link, rather I build it by myself for Win32 and Win64 with VC9. Have made the libs, build with nss-3.12.7/nspr-4.8.6 Building HTTPD with apr-util 1.4.1 with #define APU-HAVE-CRYPTO = 1 then failed with: \crypto\apr_crypto.c(113) : error C2065: 'params' : undeclared identifier .\crypto\apr_crypto.c(113) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int' .\crypto\apr_crypto.c(113) : warning C4024: 'function through pointer' : different types for formal and actual parameter 2 .\crypto\apr_crypto.c(113) : error C2198: 'function through pointer' : too few arguments for call What happens when you try and build it dynamically? Regards, Graham --
Re: : apr-util-1.4.1 failes with Crypto
On 12/08/2011 03:47 PM, Steffen wrote: When APU-HAVE-CRYPTO = 0 and build project seperate it generates fine a apr_crypto_nss-1.dll (dynam) When APU-HAVE-CRYPTO = 1 and build project seperate it fails with: -- Build started: Project: apr_crypto_nss, Configuration: Release Win32 -- Compiling... apr_crypto_nss.c .\apr_crypto_nss.c(33) : fatal error C1083: Cannot open include file: 'prerror.h': No such file or directory You should have INCLUDE set correctly. peerror.h is from NSPR. Or simply just copy those files to apr-util/include/ if you just need the .dll's Like Graham said, crypto modules are dynamic and will not work with static APR build. So you basically cannot have APU_DECLARE_STATIC and 'APU_HAVE_CRYPTO 1' Regards -- ^TM
Re: : apr-util-1.4.1 failes with Crypto
Read the Apr list about 1.4.1, understand now. Hope that we can build it out of the box like eg. the dynamic dbd. -Original Message- From: Mladen Turk Sent: Thursday, December 08, 2011 4:10 PM To: dev@httpd.apache.org Subject: Re: : apr-util-1.4.1 failes with Crypto On 12/08/2011 03:47 PM, Steffen wrote: When APU-HAVE-CRYPTO = 0 and build project seperate it generates fine a apr_crypto_nss-1.dll (dynam) When APU-HAVE-CRYPTO = 1 and build project seperate it fails with: -- Build started: Project: apr_crypto_nss, Configuration: Release Win32 -- Compiling... apr_crypto_nss.c .\apr_crypto_nss.c(33) : fatal error C1083: Cannot open include file: 'prerror.h': No such file or directory You should have INCLUDE set correctly. peerror.h is from NSPR. Or simply just copy those files to apr-util/include/ if you just need the .dll's Like Graham said, crypto modules are dynamic and will not work with static APR build. So you basically cannot have APU_DECLARE_STATIC and 'APU_HAVE_CRYPTO 1' Regards -- ^TM
RE: : apr-util-1.4.1 failes with Crypto
I want to remove my email from this mailing list, can anyone help? I have over 5000 mails from this. From: i...@apachelounge.com To: dev@httpd.apache.org Subject: Re: : apr-util-1.4.1 failes with Crypto Date: Thu, 8 Dec 2011 20:41:48 +0100 Read the Apr list about 1.4.1, understand now. Hope that we can build it out of the box like eg. the dynamic dbd. -Original Message- From: Mladen Turk Sent: Thursday, December 08, 2011 4:10 PM To: dev@httpd.apache.org Subject: Re: : apr-util-1.4.1 failes with Crypto On 12/08/2011 03:47 PM, Steffen wrote: When APU-HAVE-CRYPTO = 0 and build project seperate it generates fine a apr_crypto_nss-1.dll (dynam) When APU-HAVE-CRYPTO = 1 and build project seperate it fails with: -- Build started: Project: apr_crypto_nss, Configuration: Release Win32 -- Compiling... apr_crypto_nss.c .\apr_crypto_nss.c(33) : fatal error C1083: Cannot open include file: 'prerror.h': No such file or directory You should have INCLUDE set correctly. peerror.h is from NSPR. Or simply just copy those files to apr-util/include/ if you just need the .dll's Like Graham said, crypto modules are dynamic and will not work with static APR build. So you basically cannot have APU_DECLARE_STATIC and 'APU_HAVE_CRYPTO 1' Regards -- ^TM