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

Function alias_matches

modules/mappers/mod_alias.c:395–432  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

393}
394
395static 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
434static char *try_alias(request_rec *r)
435{

Callers 3

add_alias_internalFunction · 0.85
try_aliasFunction · 0.85
try_alias_listFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected