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

Function try_alias

modules/mappers/mod_alias.c:434–476  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

432}
433
434static char *try_alias(request_rec *r)
435{
436 alias_dir_conf *dirconf =
437 (alias_dir_conf *) ap_get_module_config(r->per_dir_config, &alias_module);
438
439 if (dirconf->alias) {
440 const char *err = NULL;
441
442 char *found = apr_pstrdup(r->pool,
443 ap_expr_str_exec(r, dirconf->alias, &err));
444 if (err) {
445 ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(02825)
446 "Can't evaluate alias expression: %s", err);
447 return PREGSUB_ERROR;
448 }
449
450 if (dirconf->alias_fake && dirconf->alias_preserve_path == ALIAS_FLAG_ON) {
451 int l;
452
453 l = alias_matches(r->uri, dirconf->alias_fake);
454
455 if (l > 0) {
456 ap_set_context_info(r, dirconf->alias_fake, found);
457 found = apr_pstrcat(r->pool, found, r->uri + l, NULL);
458 }
459 }
460
461 if (dirconf->handler) { /* Set handler, and leave a note for mod_cgi */
462 r->handler = dirconf->handler;
463 apr_table_setn(r->notes, "alias-forced-type", r->handler);
464 }
465 /* XXX This is as SLOW as can be, next step, we optimize
466 * and merge to whatever part of the found path was already
467 * canonicalized. After I finish eliminating os canonical.
468 * Better fail test for ap_server_root_relative needed here.
469 */
470 found = ap_server_root_relative(r->pool, found);
471 return found;
472
473 }
474
475 return NULL;
476}
477
478static char *try_redirect(request_rec *r, int *status)
479{

Callers 1

translate_alias_redirFunction · 0.85

Calls 5

ap_get_module_configFunction · 0.85
ap_expr_str_execFunction · 0.85
alias_matchesFunction · 0.85
ap_set_context_infoFunction · 0.85
ap_server_root_relativeFunction · 0.85

Tested by

no test coverage detected