MCPcopy Create free account
hub / github.com/apache/httpd / match_version

Function match_version

modules/metadata/mod_version.c:142–167  ·  view source on GitHub ↗

* match version against a regular expression */

Source from the content-addressed store, hash-verified

140 * match version against a regular expression
141 */
142static int match_version(apr_pool_t *pool, char *version_string,
143 const char **error)
144{
145 ap_regex_t *compiled;
146 const char *to_match;
147 int rc;
148
149 compiled = ap_pregcomp(pool, version_string, AP_REG_EXTENDED);
150 if (!compiled) {
151 *error = "Unable to compile regular expression";
152 return 0;
153 }
154
155 *error = NULL;
156
157 to_match = apr_psprintf(pool, "%d.%d.%d%s",
158 httpd_version.major,
159 httpd_version.minor,
160 httpd_version.patch,
161 httpd_version.add_string);
162
163 rc = !ap_regexec(compiled, to_match, 0, NULL, 0);
164
165 ap_pregfree(pool, compiled);
166 return rc;
167}
168
169/*
170 * Implements the <IfVersion> container

Callers 1

start_ifversionFunction · 0.85

Calls 3

ap_pregcompFunction · 0.85
ap_regexecFunction · 0.85
ap_pregfreeFunction · 0.85

Tested by

no test coverage detected