* match version against a regular expression */
| 140 | * match version against a regular expression |
| 141 | */ |
| 142 | static 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 |
no test coverage detected