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.