Thankyou Sorin! for the detailed explanation. But I couldnt find the 64-bit version of the Windows server at http://httpd.apache.org/download.cgi
I'm sorry if I'm asking a very basic question, but the above link has Unix source and Netware binaries only :( On Sat, May 11, 2013 at 1:11 PM, Sorin Manolache <sor...@gmail.com> wrote: > On 2013-05-11 08:22, Sindhi Sindhi wrote: > >> Thankyou. >> Had one more question. What is the right way of handling this - in which >> location in Apache server directory should I be keeping my filter specific >> files? >> >> As of now the XML and other files that are read by my filter are placed in >> a new folder say "MyFilter" inside "httpd-2.4.4-win64\Apache24\**htdocs". >> Is >> this the right way of doing it? >> > > I think a more "elegant" solution would be to have the location > configurable. > > For that, you define a module-specific configuration directive. (I am not > familiar with apache 2.4, all my advice is based on apache 2.2, but I > suppose there is a sufficient degree of backwards compatibility.) > > For defining configuration directives, you have to take the following > steps: > > 1. You define one or two callback functions, create_dir_config and/or > create_server_config. You put their addresses in the corresponing places in > your module structure. These callback functions are called when apache > starts up and they should create and return an application-specific > configuration object that is opaque for apache; it sees it as a void > pointer. > > The server-wide configuration object (created by create_server_config) > contains configuration data that apply to the whole virtual host. > > The directory-wide configuration object (created by create_dir_config) > contains configuration data that apply to a <Location> or <Directory>. > > So, if you have a server with 3 virtual hosts, you have 3 server > configuration objects per module. However you may have many more directory > configuration objects, depending on your Locations and Directories. > > 2. You add one entry to the cmds array of your module structure for each > configuration directive that you want to define. Each cmds array entry has > a placeholder for your configuration directive-specific callback. The > callback function is invoked by apache when it parses the configuration and > it encounters the configuration directive specified by your module. > > 3. You define the configuration directive callback. The callback gets the > arguments of the configuration directive. What the callback should do is to > retrieve somehow the configuration object created by the callback in step 1 > and initialise it with the arguments passed by apache (the configuration > values). > > The directory-wide configuration object is passed in the second argument > of the configuration callback. You just have to cast the void pointer to a > pointer to the type of your configuration object. > > The server-wide configuration object is retrieved as follows: > > ap_get_module_config(params->**server->module_config, &my_module) > > where params is the cmd_parms argument of the configuration directive > callback and my_module is the name of your module structure object. > > Note that you don't need to use both a server-wide and a directory-wide > configuration object. The simplest is to use a server-wide. However, a > directory-wide gives you more configuration flexibility. > > The callbacks in steps 1-3 are not called as part of request processing. > It's more an apache startup and configuration thing. Once apache starts > processing the requests, it is properly configured and the values of your > configuration directives are stored in the configuration objects. During > request processing you'll just have to retrieve these values from the > configuration objects. This is done is step 4: > > 4. You retrieve the configuration object of your module from the > request_rec stucture. > > For the server-wide: > MyConf *cnf = (MyConf *)ap_get_module_config(r->**server->module_config, > &my_module); > > For the directory-wide: > MyConf *cnf = (MyConf *)ap_get_module_config(r->per_**dir_config, > &my_module); > > > Also, I have downloaded the 64-bit HTTP server from - >> >> http://www.apachelounge.com/**download/win64/httpd-2.4.4-**win64.zip<http://www.apachelounge.com/download/win64/httpd-2.4.4-win64.zip> >> <http://www.**apachelounge.com/download/**win64/<http://www.apachelounge.com/download/win64/> >> > >> >> Is this the right official website to download Apache server? >> > > I think the official builds are downloaded from here: > http://httpd.apache.org/**download.cgi<http://httpd.apache.org/download.cgi> > > >> >> On Wed, May 8, 2013 at 11:04 PM, Sorin Manolache <sor...@gmail.com> >> wrote: >> >> On 2013-05-08 17:02, Sindhi Sindhi wrote: >>> >>> Hi, >>>> >>>> I have written a C++ Apache module that performs filtering of HTML >>>> content. >>>> >>>> There are some XML files which are read by this filter when it does the >>>> filtering. During run-time when this filter is invoked, I'd want the >>>> filter >>>> pick up these XML files and read them. I was thinking these XML files >>>> can >>>> be placed in the server location "C:\Program >>>> Files\httpd-2.4.4-win64\****Apache24\htdocs\MyFilter\". where MyFilter >>>> >>>> folder >>>> will contain all the XML files needed by my filter. How do I access this >>>> location programatically during run-time when the filter is invoked? >>>> >>>> How can I get the absolute path of the server installation loacation >>>> (C:\Program Files\httpd-2.4.4-win64\****Apache24\htdocs\) so that I can >>>> >>>> append >>>> "MyFilter\" to the same to get the location of the XML files? >>>> >>>> I have specified the below in httpd.conf file: >>>> DocumentRoot "C:/Program Files/httpd-2.4.4-win64/****Apache24/htdocs" >>>> ServerRoot "C:/Program Files/httpd-2.4.4-win64/****Apache24" >>>> >>>> >>>> The signature of my filter looks like this - >>>> static apr_status_t myHtmlFilter(ap_filter_t *f, apr_bucket_brigade >>>> *pbbIn) >>>> >>>> I will need the document root or server root or any other path variable >>>> that I can access from my filter that will give me the absolute path >>>> "C:/Program Files/httpd-2.4.4-win64/****Apache24" >>>> >>>> >>> const char *ap_server_root in http_main.h (apache 2.2. It could be >>> similar >>> in 2.4) contains the ServerRoot. >>> >>> ap_server_root_relative in http_config.h allows you to compose paths >>> relative to the ServerRoot. >>> >>> Sorin >>> >>> >>> Thanks. >>>> >>>> >>>> >>> >> >