]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Backport of mod_version, and the required minor MMN bump for the
authorPaul Querna <pquerna@apache.org>
Sun, 10 Apr 2005 18:16:15 +0000 (18:16 +0000)
committerPaul Querna <pquerna@apache.org>
Sun, 10 Apr 2005 18:16:15 +0000 (18:16 +0000)
new version api.

Merged from revisions 103345, 106103, 103395, and 102405.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/mod_version_for_2.0.x@160789 13f79535-47bb-0310-9956-ffa450edef68

14 files changed:
Apache.dsw
CHANGES
Makefile.win
build/mkconfNW.awk
include/ap_mmn.h
include/ap_release.h
include/httpd.h
modules/metadata/NWGNUmakefile
modules/metadata/NWGNUmodversion [new file with mode: 0644]
modules/metadata/config.m4
modules/metadata/mod_version.c [new file with mode: 0644]
modules/metadata/mod_version.dsp [new file with mode: 0644]
modules/metadata/mod_version.exp [new file with mode: 0644]
server/core.c

index 6f0f2dbe955d9db9ee5dc182bcb6b9b5de504376..ce42ea6ee695da5091155a3c1d2712acd149db96 100644 (file)
@@ -180,6 +180,9 @@ Package=<4>
     Project_Dep_Name mod_usertrack
     End Project Dependency
     Begin Project Dependency
+    Project_Dep_Name mod_version
+    End Project Dependency
+    Begin Project Dependency
     Project_Dep_Name mod_vhost_alias
     End Project Dependency
     Begin Project Dependency
@@ -1587,6 +1590,27 @@ Package=<4>
 
 ###############################################################################
 
+Project: "mod_version"=".\modules\metadata\mod_version.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+    Begin Project Dependency
+    Project_Dep_Name libapr
+    End Project Dependency
+    Begin Project Dependency
+    Project_Dep_Name libaprutil
+    End Project Dependency
+    Begin Project Dependency
+    Project_Dep_Name libhttpd
+    End Project Dependency
+}}}
+
+###############################################################################
+
 Project: "mod_vhost_alias"=".\modules\mappers\mod_vhost_alias.dsp" - Package Owner=<4>
 
 Package=<5>
diff --git a/CHANGES b/CHANGES
index da464354849bb98a9958565c7ec6b1ac4a64850a..d6c74404a4939ff59237a81a25530a337d251b3d 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,12 @@
 Changes with Apache 2.0.54
 
+  *) Added new module mod_version, which provides version dependent
+     configuration containers.  [André Malo]
+
+  *) Add core version query function (ap_get_server_revision) and
+     accompanying ap_version_t structure (minor MMN bump).
+     [André Malo]
+
   *) mod_cache: Add CacheIgnoreHeaders directive.  PR 30399.
      [Rüiger Plü <r.pluem t-online.de>]
 
index ab7d7c89e6716e8ee64f5c2d91c283f4ee80a4d8..bd3770f2fce10b681a4c4b407c048f60e4441cbc 100644 (file)
@@ -278,6 +278,7 @@ _build:
         $(MAKE) $(MAKEOPT) -f mod_setenvif.mak    CFG="mod_setenvif - Win32 $(LONG)" RECURSE=0 $(CTARGET)
         $(MAKE) $(MAKEOPT) -f mod_unique_id.mak   CFG="mod_unique_id - Win32 $(LONG)" RECURSE=0 $(CTARGET)
         $(MAKE) $(MAKEOPT) -f mod_usertrack.mak   CFG="mod_usertrack - Win32 $(LONG)" RECURSE=0 $(CTARGET)
+        $(MAKE) $(MAKEOPT) -f mod_version.mak     CFG="mod_version - Win32 $(LONG)" RECURSE=0 $(CTARGET)
        cd ..\..
        cd modules\proxy
         $(MAKE) $(MAKEOPT) -f mod_proxy.mak       CFG="mod_proxy - Win32 $(LONG)" RECURSE=0 $(CTARGET)
@@ -408,6 +409,7 @@ _copybin:
        copy modules\metadata\$(LONG)\mod_setenvif.$(src_so)    "$(inst_so)" <.y
        copy modules\metadata\$(LONG)\mod_unique_id.$(src_so)   "$(inst_so)" <.y
        copy modules\metadata\$(LONG)\mod_usertrack.$(src_so)   "$(inst_so)" <.y
+       copy modules\metadata\$(LONG)\mod_version.$(src_so)     "$(inst_so)" <.y
        copy modules\proxy\$(LONG)\mod_proxy.$(src_so)          "$(inst_so)" <.y
        copy modules\proxy\$(LONG)\mod_proxy_connect.$(src_so)  "$(inst_so)" <.y
        copy modules\proxy\$(LONG)\mod_proxy_ftp.$(src_so)      "$(inst_so)" <.y
index 8ae207693c7caf31aea6c563d81f4b63f6612f30..530c5eae6c93699ca7df10bde567c79b9291da25 100644 (file)
@@ -60,6 +60,7 @@ BEGIN {
     print "#LoadModule status_module modules/status.nlm"
     print "#LoadModule unique_id_module modules/uniqueid.nlm"
     print "#LoadModule usertrack_module modules/usertrk.nlm"
+    print "#LoadModule version_module modules/modversion.nlm"
     print "#LoadModule vhost_alias_module modules/vhost.nlm"
     print ""
     next
index fb4e262dc69e6d266d3076389736825f9f4169b0..8edd2b0be034e810c29dae45b11c7d13359f6870 100644 (file)
@@ -83,6 +83,7 @@
  *                         ap_finalize_sub_req_protocol on Win32 and NetWare
  * 20020903.9 (2.0.51-dev) create pcommands and initialize arrays before
  *                         calling ap_setup_prelinked_modules
+ * 20020903.10 (2.0.54-dev) added ap_get_server_revision / ap_version_t
  */
 
 #define MODULE_MAGIC_COOKIE 0x41503230UL /* "AP20" */
@@ -90,7 +91,7 @@
 #ifndef MODULE_MAGIC_NUMBER_MAJOR
 #define MODULE_MAGIC_NUMBER_MAJOR 20020903
 #endif
-#define MODULE_MAGIC_NUMBER_MINOR 9                     /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 10                     /* 0...n */
 
 /**
  * Determine if the server's current MODULE_MAGIC_NUMBER is at least a
index 3422b74bf19757fd180a4e83ff62c87e0f64bdfe..6f7dcdd6d658f8325ffcad501f1d48c177fba596 100644 (file)
@@ -17,6 +17,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.
  */
 #define AP_SERVER_BASEVENDOR "Apache Software Foundation"
 #define AP_SERVER_BASEPRODUCT "Apache"
-#define AP_SERVER_MAJORVERSION "2"
-#define AP_SERVER_MINORVERSION "0"
-#define AP_SERVER_PATCHLEVEL "54-dev"
+
+#define AP_SERVER_MAJORVERSION_NUMBER 2
+#define AP_SERVER_MINORVERSION_NUMBER 0
+#define AP_SERVER_PATCHLEVEL_NUMBER   54
+#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
index 16dad6cae6c649495a4462c9cbf33a807b74738e..2417582d327a44ba61e86f46dc0521d064e171c8 100644 (file)
@@ -378,6 +378,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
index c23e762a0fc1749fbb4c21ac191a2bc546aa4546..fe1ecf21637a4f71a751448bd9b31cba7add8dba 100644 (file)
@@ -159,6 +159,7 @@ TARGET_nlm = \
        $(OBJDIR)/mimemagi.nlm \
        $(OBJDIR)/uniqueid.nlm \
        $(OBJDIR)/usertrk.nlm \
+       $(OBJDIR)/modversion.nlm \
        $(EOLIST)
 
 #
diff --git a/modules/metadata/NWGNUmodversion b/modules/metadata/NWGNUmodversion
new file mode 100644 (file)
index 0000000..47b2469
--- /dev/null
@@ -0,0 +1,250 @@
+#
+# Make sure all needed macro's are defined
+#
+
+#
+# Get the 'head' of the build environment if necessary.  This includes default
+# targets and paths to tools
+#
+
+ifndef EnvironmentDefined
+include $(AP_WORK)\build\NWGNUhead.inc
+endif
+
+#
+# These directories will be at the beginning of the include list, followed by
+# INCDIRS
+#
+XINCDIRS       += \
+                       $(AP_WORK)/include \
+                       $(NWOS) \
+                       $(AP_WORK)/modules/arch/netware \
+                       $(AP_WORK)/srclib/apr/include \
+                       $(AP_WORK)/srclib/apr-util/include \
+                       $(AP_WORK)/srclib/apr \
+                       $(EOLIST)
+
+#
+# These flags will come after CFLAGS
+#
+XCFLAGS                += \
+                       -prefix pre_nw.h \
+                       $(EOLIST)
+
+#
+# These defines will come after DEFINES
+#
+XDEFINES       += \
+                       $(EOLIST)
+
+#
+# These flags will be added to the link.opt file
+#
+XLFLAGS                += \
+                       $(EOLIST)
+
+#
+# These values will be appended to the correct variables based on the value of
+# RELEASE
+#
+ifeq "$(RELEASE)" "debug"
+XINCDIRS       += \
+                       $(EOLIST)
+
+XCFLAGS                += \
+                       $(EOLIST)
+
+XDEFINES       += \
+                       $(EOLIST)
+
+XLFLAGS                += \
+                       $(EOLIST)
+endif
+
+ifeq "$(RELEASE)" "noopt"
+XINCDIRS       += \
+                       $(EOLIST)
+
+XCFLAGS                += \
+                       $(EOLIST)
+
+XDEFINES       += \
+                       $(EOLIST)
+
+XLFLAGS                += \
+                       $(EOLIST)
+endif
+
+ifeq "$(RELEASE)" "release"
+XINCDIRS       += \
+                       $(EOLIST)
+
+XCFLAGS                += \
+                       $(EOLIST)
+
+XDEFINES       += \
+                       $(EOLIST)
+
+XLFLAGS                += \
+                       $(EOLIST)
+endif
+
+#
+# These are used by the link target if an NLM is being generated
+# This is used by the link 'name' directive to name the nlm.  If left blank
+# TARGET_nlm (see below) will be used.
+#
+NLM_NAME               = modversion
+
+#
+# This is used by the link '-desc ' directive. 
+# If left blank, NLM_NAME will be used.
+#
+NLM_DESCRIPTION        = Apache $(VERSION_STR) Version Module
+
+#
+# This is used by the '-threadname' directive.  If left blank,
+# NLM_NAME Thread will be used.
+#
+NLM_THREAD_NAME        = Version Module
+
+#
+# If this is specified, it will override VERSION value in 
+# $(AP_WORK)\build\NWGNUenvironment.inc
+#
+NLM_VERSION            =
+
+#
+# If this is specified, it will override the default of 64K
+#
+NLM_STACK_SIZE = 8192
+
+
+#
+# If this is specified it will be used by the link '-entry' directive
+#
+NLM_ENTRY_SYM  = _LibCPrelude
+
+#
+# If this is specified it will be used by the link '-exit' directive
+#
+NLM_EXIT_SYM   = _LibCPostlude
+
+#
+# If this is specified it will be used by the link '-check' directive
+#
+NLM_CHECK_SYM  =
+
+#
+# If these are specified it will be used by the link '-flags' directive
+#
+NLM_FLAGS              =  AUTOUNLOAD, PSEUDOPREEMPTION
+
+#
+# If this is specified it will be linked in with the XDCData option in the def 
+# file instead of the default of $(NWOS)/apache.xdc.  XDCData can be disabled
+# by setting APACHE_UNIPROC in the environment
+#
+XDCDATA         = 
+
+#
+# If there is an NLM target, put it here
+#
+TARGET_nlm = \
+       $(OBJDIR)/$(NLM_NAME).nlm \
+       $(EOLIST)
+
+#
+# If there is an LIB target, put it here
+#
+TARGET_lib = \
+       $(EOLIST)
+
+#
+# These are the OBJ files needed to create the NLM target above.
+# Paths must all use the '/' character
+#
+FILES_nlm_objs = \
+       $(OBJDIR)/mod_version.o \
+       $(EOLIST)
+
+#
+# These are the LIB files needed to create the NLM target above.
+# These will be added as a library command in the link.opt file.
+#
+FILES_nlm_libs = \
+       libcpre.o \
+       $(EOLIST)
+
+#
+# These are the modules that the above NLM target depends on to load.
+# These will be added as a module command in the link.opt file.
+#
+FILES_nlm_modules = \
+       aprlib \
+       libc \
+       $(EOLIST)
+
+#
+# If the nlm has a msg file, put it's path here
+#
+FILE_nlm_msg =
+#
+# If the nlm has a hlp file put it's path here
+#
+FILE_nlm_hlp =
+
+#
+# If this is specified, it will override $(NWOS)\copyright.txt.
+#
+FILE_nlm_copyright =
+
+#
+# Any additional imports go here
+#
+FILES_nlm_Ximports = \
+       @$(APR)/aprlib.imp \
+       @$(NWOS)/httpd.imp \
+       @libc.imp \
+       $(EOLIST)
+#   
+# Any symbols exported to here
+#
+FILES_nlm_exports = \
+       version_module \
+       $(EOLIST)
+       
+#   
+# These are the OBJ files needed to create the LIB target above.
+# Paths must all use the '/' character
+#
+FILES_lib_objs = \
+               $(EOLIST)
+
+#
+# implement targets and dependancies (leave this section alone)
+#
+
+libs :: $(OBJDIR) $(TARGET_lib)
+
+nlms :: libs $(TARGET_nlm)
+
+#
+# Updated this target to create necessary directories and copy files to the 
+# correct place.  (See $(AP_WORK)\build\NWGNUhead.inc for examples)
+#
+install :: nlms FORCE
+
+#
+# Any specialized rules here
+#
+
+#
+# Include the 'tail' makefile that has targets that depend on variables defined
+# in this makefile
+#
+
+include $(AP_WORK)\build\NWGNUtail.inc
+
index cd08b428765f5a108f9d40a6c611601d2565c317..3fc1b2ced68588d2d83769fa46407d24526413cb 100644 (file)
@@ -17,6 +17,7 @@ APACHE_MODULE(usertrack, user-session tracking, , , , [
 
 APACHE_MODULE(unique_id, per-request unique ids)
 APACHE_MODULE(setenvif, basing ENV vars on headers, , , yes)
+APACHE_MODULE(version, determining httpd version in config files)
 
 APR_ADDTO(LT_LDFLAGS,-export-dynamic)
 
diff --git a/modules/metadata/mod_version.c b/modules/metadata/mod_version.c
new file mode 100644 (file)
index 0000000..e4ade98
--- /dev/null
@@ -0,0 +1,311 @@
+/* Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * mod_version.c
+ * Allow conditional configuration depending on the httpd version
+ * 
+ * André Malo (nd/perlig.de), January 2004
+ *
+ * Some stuff coded here is heavily based on the core <IfModule>
+ * containers.
+ *
+ * The module makes the following confgurations possible:
+ *
+ * <IfVersion op major.minor.patch>
+ *     # conditional config here ...
+ *</IfVersion>
+ *
+ * where "op" is one of:
+ * = / ==       equal
+ * >            greater than
+ * >=           greater or equal
+ * <            less than
+ * <=           less or equal
+ *
+ * If minor version and patch level are omitted they are assumed to be 0.
+ *
+ * Alternatively you can match the whole version (including some vendor-added
+ * string of the CORE version, see ap_release.h) against a regular expression:
+ *
+ * <IfVersion op regex>
+ *     # conditional config here ...
+ *</IfVersion>
+ *
+ * where "op" is one of:
+ * = / ==       match; regex must be surrounded by slashes
+ * ~            match; regex MAY NOT be surrounded by slashes
+ *
+ * Note that all operators may be preceeded by an exclamation mark
+ * (without spaces) in order to reverse their meaning.
+ *
+ */
+
+#include "apr.h"
+#include "apr_strings.h"
+#include "apr_lib.h"
+
+#include "httpd.h"
+#include "http_config.h"
+#include "http_log.h"
+
+
+/* module structure */
+module AP_MODULE_DECLARE_DATA version_module;
+
+/* queried httpd version */
+static ap_version_t httpd_version;
+
+
+/*
+ * compare the supplied version with the core one
+ */
+static int compare_version(char *version_string, const char **error)
+{
+    char *p = version_string, *ep;
+    int version[3] = {0, 0, 0};
+    int c = 0;
+
+    *error = "Version appears to be invalid. It must have the format "
+             "major[.minor[.patch]] where major, minor and patch are "
+             "numbers.";
+
+    if (!apr_isdigit(*p)) {
+        return 0;
+    }
+
+    /* parse supplied version */
+    ep = version_string + strlen(version_string);
+    while (p <= ep && c < 3) {
+        if (*p == '.') {
+            *p = '\0';
+        }
+
+        if (!*p) {
+            version[c++] = atoi(version_string);
+            version_string = ++p;
+            continue;
+        }
+
+        if (!apr_isdigit(*p)) {
+            break;
+        }
+
+        ++p;
+    }
+
+    if (p < ep) { /* syntax error */
+        return 0;
+    }
+
+    *error = NULL;
+
+    if      (httpd_version.major > version[0]) {
+        return 1;
+    }
+    else if (httpd_version.major < version[0]) {
+        return -1;
+    }
+    else if (httpd_version.minor > version[1]) {
+        return 1;
+    }
+    else if (httpd_version.minor < version[1]) {
+        return -1;
+    }
+    else if (httpd_version.patch > version[2]) {
+        return 1;
+    }
+    else if (httpd_version.patch < version[2]) {
+        return -1;
+    }
+
+    /* seems to be the same */
+    return 0;
+}
+
+/*
+ * match version against a regular expression
+ */
+static int match_version(apr_pool_t *pool, char *version_string,
+                         const char **error)
+{
+    regex_t *compiled;
+    const char *to_match;
+    int rc;
+
+    compiled = ap_pregcomp(pool, version_string, REG_EXTENDED);
+    if (!compiled) {
+        *error = "Unable to compile regular expression";
+        return 0;
+    }
+
+    *error = NULL;
+
+    to_match = apr_psprintf(pool, "%d.%d.%d%s",
+                            httpd_version.major,
+                            httpd_version.minor,
+                            httpd_version.patch,
+                            httpd_version.add_string);
+
+    rc = !ap_regexec(compiled, to_match, 0, NULL, 0);
+
+    ap_pregfree(pool, compiled);
+    return rc;    
+}
+
+/*
+ * Implements the <IfVersion> container
+ */
+static const char *start_ifversion(cmd_parms *cmd, void *mconfig,
+                                   const char *arg1, const char *arg2,
+                                   const char *arg3)
+{
+    const char *endp;
+    int reverse = 0, done = 0, match = 0, compare;
+    const char *p, *error;
+    char c;
+
+    /* supplying one argument is possible, we assume an equality check then */
+    if (!arg2) {
+        arg2 = arg1;
+        arg1 = "=";
+    }
+
+    /* surrounding quotes without operator */
+    if (!arg3 && *arg2 == '>' && !arg2[1]) {
+        arg3 = ">";
+        arg2 = arg1;
+        arg1 = "=";
+    }
+
+    /* the third argument makes version surrounding quotes plus operator
+     * possible.
+     */
+    endp = arg2 + strlen(arg2);
+    if (   endp == arg2
+        || (!(arg3 && *arg3 == '>' && !arg3[1]) && *--endp != '>')) {
+        return apr_pstrcat(cmd->pool, cmd->cmd->name,
+                           "> directive missing closing '>'", NULL);
+    }
+
+    p = arg1;
+    if (*p == '!') {
+        reverse = 1;
+        if (p[1]) {
+            ++p;
+        }
+    }
+
+    c = *p++;
+    if (!*p || (*p == '=' && !p[1] && c != '~')) {
+        if (!httpd_version.major) {
+            ap_get_server_revision(&httpd_version);
+        }
+
+        done = 1;
+        switch (c) {
+        case '=':
+            /* normal comparison */
+            if (*arg2 != '/') {
+                compare = compare_version(apr_pstrmemdup(cmd->pool, arg2,
+                                                         endp-arg2),
+                                          &error);
+                if (error) {
+                    return error;
+                }
+
+                match = !compare;
+                break;
+            }
+
+            /* regexp otherwise */
+            if (endp == ++arg2 || *--endp != '/') {
+                return "Missing delimiting / of regular expression.";
+            }
+
+        case '~':
+            /* regular expression */
+            match = match_version(cmd->pool, apr_pstrmemdup(cmd->pool, arg2,
+                                                            endp-arg2),
+                                  &error);
+            if (error) {
+                return error;
+            }
+            break;
+
+        case '<':
+            compare = compare_version(apr_pstrmemdup(cmd->pool, arg2,
+                                                     endp-arg2),
+                                      &error);
+            if (error) {
+                return error;
+            }
+
+            match = ((-1 == compare) || (*p && !compare));
+            break;
+
+        case '>':
+            compare = compare_version(apr_pstrmemdup(cmd->pool, arg2,
+                                                     endp-arg2),
+                                      &error);
+            if (error) {
+                return error;
+            }
+
+            match = ((1 == compare) || (*p && !compare));
+            break;
+
+        default:
+            done = 0;
+            break;
+        }
+    }
+
+    if (!done) {
+        return apr_pstrcat(cmd->pool, "unrecognized operator '", arg1, "'",
+                           NULL);
+    }
+
+    if ((!reverse && match) || (reverse && !match)) {
+        ap_directive_t *parent = NULL;
+        ap_directive_t *current = NULL;
+        const char *retval;
+
+        retval = ap_build_cont_config(cmd->pool, cmd->temp_pool, cmd,
+                                      &current, &parent, "<IfVersion");
+        *(ap_directive_t **)mconfig = current;
+        return retval;
+    }
+
+    *(ap_directive_t **)mconfig = NULL;
+    return ap_soak_end_container(cmd, "<IfVersion");
+}
+
+static const command_rec version_cmds[] = {
+    AP_INIT_TAKE123("<IfVersion", start_ifversion, NULL, EXEC_ON_READ | OR_ALL,
+                    "a comparison operator, a version (and a delimiter)"),
+    { NULL }
+};
+
+module AP_MODULE_DECLARE_DATA version_module =
+{
+    STANDARD20_MODULE_STUFF,
+    NULL,             /* dir config creater */
+    NULL,             /* dir merger --- default is to override */
+    NULL,             /* server config */
+    NULL,             /* merge server configs */
+    version_cmds,     /* command apr_table_t */
+    NULL,             /* register hooks */
+};
diff --git a/modules/metadata/mod_version.dsp b/modules/metadata/mod_version.dsp
new file mode 100644 (file)
index 0000000..9b4a9bb
--- /dev/null
@@ -0,0 +1,128 @@
+# Microsoft Developer Studio Project File - Name="mod_version" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=mod_version - Win32 Release
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "mod_version.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "mod_version.mak" CFG="mod_version - Win32 Release"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "mod_version - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "mod_version - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "mod_version - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c
+# ADD CPP /nologo /MD /W3 /Zi /O2 /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Release\mod_version_src" /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib /nologo /subsystem:windows /dll /machine:I386 /out:"Release/mod_version.so" /base:@..\..\os\win32\BaseAddr.ref,mod_version.so
+# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /debug /machine:I386 /out:"Release/mod_version.so" /base:@..\..\os\win32\BaseAddr.ref,mod_version.so /opt:ref
+
+!ELSEIF  "$(CFG)" == "mod_version - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MDd /W3 /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c
+# ADD CPP /nologo /MDd /W3 /GX /Zi /Od /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Debug\mod_version_src" /FD /c
+# ADD BASE MTL /nologo /D "_DEBUG" /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /debug /machine:I386 /out:"Debug/mod_version.so" /base:@..\..\os\win32\BaseAddr.ref,mod_version.so
+# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /debug /machine:I386 /out:"Debug/mod_version.so" /base:@..\..\os\win32\BaseAddr.ref,mod_version.so
+
+!ENDIF 
+
+# Begin Target
+
+# Name "mod_version - Win32 Release"
+# Name "mod_version - Win32 Debug"
+# Begin Source File
+
+SOURCE=.\mod_version.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\mod_version.rc
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\build\win32\win32ver.awk
+
+!IF  "$(CFG)" == "mod_version - Win32 Release"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Creating Version Resource
+InputPath=..\..\build\win32\win32ver.awk
+
+".\mod_version.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+       awk -f ../../build/win32/win32ver.awk mod_version.so "version_module for Apache" ../../include/ap_release.h  > .\mod_version.rc
+
+# End Custom Build
+
+!ELSEIF  "$(CFG)" == "mod_version - Win32 Debug"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Creating Version Resource
+InputPath=..\..\build\win32\win32ver.awk
+
+".\mod_version.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+       awk -f ../../build/win32/win32ver.awk mod_version.so "version_module for Apache" ../../include/ap_release.h  > .\mod_version.rc
+
+# End Custom Build
+
+!ENDIF 
+
+# End Source File
+# End Target
+# End Project
diff --git a/modules/metadata/mod_version.exp b/modules/metadata/mod_version.exp
new file mode 100644 (file)
index 0000000..3dce845
--- /dev/null
@@ -0,0 +1 @@
+version_module
index fbc1763ac716bec8cb001d6db8547a73a08b33f3..563e07d6c0919f354cafbbaa3aed6ac2be551491 100644 (file)
@@ -2442,6 +2442,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);