Add core version query function ap_get_server_revision and

accompanying ap_version_t structure (minor MMN bump).
The function is similar to apr_version() and allow for exact
querying of the core revision level.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@102405 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
André Malo
2004-01-25 22:03:38 +00:00
parent f3e22caf1a
commit 02bc2a93e8
5 changed files with 47 additions and 4 deletions

View File

@ -2,6 +2,10 @@ Changes with Apache 2.1.0-dev
[Remove entries to the current 2.0 section below, when backported]
*) Add core version query function (ap_get_server_revision) and
accompanying ap_version_t structure (minor MMN bump).
[Andr<64> Malo]
*) mod_rewrite: EOLs sent by external rewritemaps are now consumed
as whole. That way, on systems with more than one EOL character
rewritemap programs no longer need to switch stdout to binary

View File

@ -118,6 +118,7 @@
* 20030821 (2.1.0-dev) bumped mod_include's entire API
* 20030821.1 (2.1.0-dev) added XHTML doctypes
* 20030821.2 (2.1.0-dev) added ap_escape_errorlog_item
* 20030821.3 (2.1.0-dev) added ap_get_server_revision / ap_version_t
*/
#define MODULE_MAGIC_COOKIE 0x41503230UL /* "AP20" */
@ -125,7 +126,7 @@
#ifndef MODULE_MAGIC_NUMBER_MAJOR
#define MODULE_MAGIC_NUMBER_MAJOR 20030821
#endif
#define MODULE_MAGIC_NUMBER_MINOR 2 /* 0...n */
#define MODULE_MAGIC_NUMBER_MINOR 3 /* 0...n */
/**
* Determine if the server's current MODULE_MAGIC_NUMBER is at least a

View File

@ -59,6 +59,8 @@
#ifndef AP_RELEASE_H
#define AP_RELEASE_H
#include "apr_general.h" /* stringify */
/*
* The below defines the base string of the Server: header. Additional
* tokens can be added via the ap_add_version_component() API call.
@ -73,9 +75,18 @@
*/
#define AP_SERVER_BASEVENDOR "Apache Software Foundation"
#define AP_SERVER_BASEPRODUCT "Apache"
#define AP_SERVER_MAJORVERSION "2"
#define AP_SERVER_MINORVERSION "1"
#define AP_SERVER_PATCHLEVEL "0-dev"
#define AP_SERVER_MAJORVERSION_NUMBER 2
#define AP_SERVER_MINORVERSION_NUMBER 1
#define AP_SERVER_PATCHLEVEL_NUMBER 0
#define AP_SERVER_ADD_STRING "-dev"
/* keep old macros as well */
#define AP_SERVER_MAJORVERSION APR_STRINGIFY(AP_SERVER_MAJORVERSION_NUMBER)
#define AP_SERVER_MINORVERSION APR_STRINGIFY(AP_SERVER_MINORVERSION_NUMBER)
#define AP_SERVER_PATCHLEVEL APR_STRINGIFY(AP_SERVER_PATCHLEVEL_NUMBER) \
AP_SERVER_ADD_STRING
#define AP_SERVER_MINORREVISION AP_SERVER_MAJORVERSION "." AP_SERVER_MINORVERSION
#define AP_SERVER_BASEREVISION AP_SERVER_MINORREVISION "." AP_SERVER_PATCHLEVEL
#define AP_SERVER_BASEVERSION AP_SERVER_BASEPRODUCT "/" AP_SERVER_BASEREVISION

View File

@ -415,6 +415,25 @@ extern "C" {
# define AP_CORE_DECLARE_NONSTD AP_DECLARE_NONSTD
#endif
/**
* The numeric version information is broken out into fields within this
* structure.
*/
typedef struct {
int major; /**< major number */
int minor; /**< minor number */
int patch; /**< patch number */
const char *add_string; /**< additional string like "-dev" */
} ap_version_t;
/**
* Return httpd's version information in a numeric form.
*
* @param version Pointer to a version structure for returning the version
* information.
*/
AP_DECLARE(void) ap_get_server_revision(ap_version_t *version);
/**
* Get the server version string
* @return The server version string

View File

@ -2364,6 +2364,14 @@ static apr_status_t reset_version(void *dummy)
return APR_SUCCESS;
}
AP_DECLARE(void) ap_get_server_revision(ap_version_t *version)
{
version->major = AP_SERVER_MAJORVERSION_NUMBER;
version->minor = AP_SERVER_MINORVERSION_NUMBER;
version->patch = AP_SERVER_PATCHLEVEL_NUMBER;
version->add_string = AP_SERVER_ADD_STRING;
}
AP_DECLARE(const char *) ap_get_server_version(void)
{
return (server_version ? server_version : AP_SERVER_BASEVERSION);