I am writing an Apache module and wish to obtain a string using the Apache title version along with other particulars. Similar to what will get put into outgoing headers, e.g.:

Server: Apache/2.2.13 (Win32)

I have attempted code such as this:

apr_table_get(request_rec->headers_out,"Server")

But that does not appear to operate. Can there be an API call I've not found or shall we be held condemned to obtain version resource data from httpd.exe?

do this command

apache2 -v

should print something similar to this

Server version: Apache/2.2.11 (Ubuntu)
Server built:   Mar  9 2010 21:05:51

most unix instructions possess a -v option

it appears like you are attempting to have it from php, the professional command in php enables you to run the command around the server

I am unsure about Apache modules, however for CGI scripts, the title from the current web server is saved within the SERVER_SOFTWARE atmosphere variable. In Perl, for instance, you would employ $ENV{SERVER_SOFTWARE} to see it. In C you would employ getenv ("SERVER_SOFTWARE").

To be able to discover the server software, why don't you just grep with the Apache source codes to locate where this really is defined.

Carrying this out with Apache 1.3.41, I've found that it's defined inside a file known as util_script.c online 240 the following:

ap_table_addn(e, "SERVER_SOFTWARE", ap_get_server_version());

It appears like there's a function known as ap_get_server_version which returns the worthiness like a string.

Thought it was: ap_get_server_version, my HTTPD2 API wrapper didn't have this declaration