| 197 | } |
| 198 | |
| 199 | AP_DECLARE(int) ap_strcasecmp_match(const char *str, const char *expected) |
| 200 | { |
| 201 | apr_size_t x, y; |
| 202 | |
| 203 | for (x = 0, y = 0; expected[y]; ++y, ++x) { |
| 204 | if (!str[x] && expected[y] != '*') |
| 205 | return -1; |
| 206 | if (expected[y] == '*') { |
| 207 | while (expected[++y] == '*'); |
| 208 | if (!expected[y]) |
| 209 | return 0; |
| 210 | while (str[x]) { |
| 211 | int ret; |
| 212 | if ((ret = ap_strcasecmp_match(&str[x++], &expected[y])) != 1) |
| 213 | return ret; |
| 214 | } |
| 215 | return -1; |
| 216 | } |
| 217 | else if (expected[y] != '?' |
| 218 | && apr_tolower(str[x]) != apr_tolower(expected[y])) |
| 219 | return 1; |
| 220 | } |
| 221 | return (str[x] != '\0'); |
| 222 | } |
| 223 | |
| 224 | /* We actually compare the canonical root to this root, (but we don't |
| 225 | * waste time checking the case), since every use of this function in |
no outgoing calls
no test coverage detected