/* Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You 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 preceded by an exclamation mark * (without spaces) in order to reverse their meaning. *
*/
/* queried httpd version */ static ap_version_t httpd_version;
/* * compare the supplied version with the core one
*/ staticint compare_version(char *version_string, constchar **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';
}
/* * match version against a regular expression
*/ staticint match_version(apr_pool_t *pool, char *version_string, constchar **error)
{
ap_regex_t *compiled; constchar *to_match; int rc;
compiled = ap_pregcomp(pool, version_string, AP_REG_EXTENDED); if (!compiled) {
*error = "Unable to compile regular expression"; return 0;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.