| 393 | } |
| 394 | |
| 395 | static int alias_matches(const char *uri, const char *alias_fakename) |
| 396 | { |
| 397 | const char *aliasp = alias_fakename, *urip = uri; |
| 398 | |
| 399 | while (*aliasp) { |
| 400 | if (*aliasp == '/') { |
| 401 | /* any number of '/' in the alias matches any number in |
| 402 | * the supplied URI, but there must be at least one... |
| 403 | */ |
| 404 | if (*urip != '/') |
| 405 | return 0; |
| 406 | |
| 407 | do { |
| 408 | ++aliasp; |
| 409 | } while (*aliasp == '/'); |
| 410 | do { |
| 411 | ++urip; |
| 412 | } while (*urip == '/'); |
| 413 | } |
| 414 | else { |
| 415 | /* Other characters are compared literally */ |
| 416 | if (*urip++ != *aliasp++) |
| 417 | return 0; |
| 418 | } |
| 419 | } |
| 420 | |
| 421 | /* Check last alias path component matched all the way */ |
| 422 | |
| 423 | if (aliasp[-1] != '/' && *urip != '\0' && *urip != '/') |
| 424 | return 0; |
| 425 | |
| 426 | /* Return number of characters from URI which matched (may be |
| 427 | * greater than length of alias, since we may have matched |
| 428 | * doubled slashes) |
| 429 | */ |
| 430 | |
| 431 | return urip - uri; |
| 432 | } |
| 433 | |
| 434 | static char *try_alias(request_rec *r) |
| 435 | { |
no outgoing calls
no test coverage detected