Apache HTTPD
mod_alias.c
Go to the documentation of this file.
1/* Licensed to the Apache Software Foundation (ASF) under one or more
2 * contributor license agreements. See the NOTICE file distributed with
3 * this work for additional information regarding copyright ownership.
4 * The ASF licenses this file to You under the Apache License, Version 2.0
5 * (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/*
18 * http_alias.c: Stuff for dealing with directory aliases
19 *
20 * Original by Rob McCool, rewritten in succession by David Robinson
21 * and rst.
22 *
23 */
24
25#include "apr_strings.h"
26#include "apr_lib.h"
27
28#define APR_WANT_STRFUNC
29#include "apr_want.h"
30
31#include "ap_config.h"
32#include "httpd.h"
33#include "http_core.h"
34#include "http_config.h"
35#include "http_request.h"
36#include "http_log.h"
37#include "ap_expr.h"
38
39
40#define ALIAS_FLAG_DEFAULT -1
41#define ALIAS_FLAG_OFF 0
42#define ALIAS_FLAG_ON 1
43
44#define ALIAS_PRESERVE_PATH_DEFAULT 0
45
46typedef struct {
47 const char *real;
48 const char *fake;
49 char *handler;
51 int redir_status; /* 301, 302, 303, 410, etc */
53
58
59typedef struct {
60 unsigned int alias_set:1;
61 unsigned int redirect_set:1;
64 const char *alias_fake;
65 char *handler;
67 int redirect_status; /* 301, 302, 303, 410, etc */
68 int allow_relative; /* skip ap_construct_url() */
69 int alias_preserve_path; /* map full path */
71
72module AP_MODULE_DECLARE_DATA alias_module;
73
75#define PREGSUB_ERROR (&magic_error_value)
76
78{
81
82 a->aliases = apr_array_make(p, 20, sizeof(alias_entry));
83 a->redirects = apr_array_make(p, 20, sizeof(alias_entry));
84 return a;
85}
86
88{
91 a->redirects = apr_array_make(p, 2, sizeof(alias_entry));
92 a->allow_relative = ALIAS_FLAG_DEFAULT;
93 a->alias_preserve_path = ALIAS_FLAG_DEFAULT;
94 return a;
95}
96
97static void *merge_alias_config(apr_pool_t *p, void *basev, void *overridesv)
98{
103
104 a->aliases = apr_array_append(p, overrides->aliases, base->aliases);
105 a->redirects = apr_array_append(p, overrides->redirects, base->redirects);
106 return a;
107}
108
110{
115
116 a->redirects = apr_array_append(p, overrides->redirects, base->redirects);
117
118 a->alias = (overrides->alias_set == 0) ? base->alias : overrides->alias;
119 a->alias_fake = (overrides->alias_set == 0) ? base->alias_fake : overrides->alias_fake;
120 a->handler = (overrides->alias_set == 0) ? base->handler : overrides->handler;
121 a->alias_set = overrides->alias_set || base->alias_set;
122
123 a->redirect = (overrides->redirect_set == 0) ? base->redirect : overrides->redirect;
124 a->redirect_status = (overrides->redirect_set == 0) ? base->redirect_status : overrides->redirect_status;
125 a->redirect_set = overrides->redirect_set || base->redirect_set;
126 a->allow_relative = (overrides->allow_relative != ALIAS_FLAG_DEFAULT)
127 ? overrides->allow_relative
128 : base->allow_relative;
129 a->alias_preserve_path = (overrides->alias_preserve_path != ALIAS_FLAG_DEFAULT)
130 ? overrides->alias_preserve_path
131 : base->alias_preserve_path;
132
133 return a;
134}
135
136/* need prototype for overlap check */
137static int alias_matches(const char *uri, const char *alias_fakename);
138
139static const char *add_alias_internal(cmd_parms *cmd, void *dummy,
140 const char *fake, const char *real,
141 int use_regex)
142{
143 server_rec *s = cmd->server;
144 alias_server_conf *conf = ap_get_module_config(s->module_config,
145 &alias_module);
146 alias_entry *new = apr_array_push(conf->aliases);
147 alias_entry *entries = (alias_entry *)conf->aliases->elts;
148 int i;
149
150 /* XXX: real can NOT be relative to DocumentRoot here... compat bug. */
151
153
154 if (err != NULL) {
155 return err;
156 }
157
158 if (use_regex) {
159 new->regexp = ap_pregcomp(cmd->pool, fake, AP_REG_EXTENDED);
160 if (new->regexp == NULL)
161 return "Regular expression could not be compiled.";
162 new->real = real;
163 }
164 else {
165 /* XXX This may be optimized, but we must know that new->real
166 * exists. If so, we can dir merge later, trusing new->real
167 * and just canonicalizing the remainder. Not till I finish
168 * cleaning out the old ap_canonical stuff first.
169 */
170 new->real = real;
171 }
172 new->fake = fake;
173 new->handler = cmd->info;
174
175 /* check for overlapping (Script)Alias directives
176 * and throw a warning if found one
177 */
178 if (!use_regex) {
179 for (i = 0; i < conf->aliases->nelts - 1; ++i) {
180 alias_entry *alias = &entries[i];
181
182 if ( (!alias->regexp && alias_matches(fake, alias->fake) > 0)
183 || (alias->regexp && !ap_regexec(alias->regexp, fake, 0, NULL, 0))) {
184 ap_log_error(APLOG_MARK, APLOG_WARNING, 0, cmd->server, APLOGNO(00671)
185 "The %s directive in %s at line %d will probably "
186 "never match because it overlaps an earlier "
187 "%sAlias%s.",
188 cmd->cmd->name, cmd->directive->filename,
189 cmd->directive->line_num,
190 alias->handler ? "Script" : "",
191 alias->regexp ? "Match" : "");
192
193 break; /* one warning per alias should be sufficient */
194 }
195 }
196 }
197
198 return NULL;
199}
200
201static const char *add_alias(cmd_parms *cmd, void *dummy, const char *fake,
202 const char *real)
203{
204 if (real) {
205
206 return add_alias_internal(cmd, dummy, fake, real, 0);
207
208 }
209 else {
211
213
214 if (err != NULL) {
215 return err;
216 }
217
218 if (!cmd->path) {
219 return "Alias must have two arguments when used globally";
220 }
221
222 dirconf->alias =
224 &err, NULL);
225 if (err) {
226 return apr_pstrcat(cmd->temp_pool,
227 "Cannot parse alias expression '", fake, "': ", err,
228 NULL);
229 }
230
231 dirconf->alias_fake = cmd->path;
232 dirconf->handler = cmd->info;
233 dirconf->alias_set = 1;
234
235 return NULL;
236
237 }
238}
239
240static const char *add_alias_regex(cmd_parms *cmd, void *dummy,
241 const char *fake, const char *real)
242{
243 return add_alias_internal(cmd, dummy, fake, real, 1);
244}
245
248 const char *arg1, const char *arg2,
249 const char *arg3, int use_regex)
250{
251 alias_entry *new;
252 server_rec *s = cmd->server;
254 &alias_module);
255 int status = (int) (long) cmd->info;
256 int grokarg1 = 1;
258 const char *fake = arg2;
259 const char *url = arg3;
260
261 /*
262 * Logic flow:
263 * Go ahead and try to grok the 1st arg, in case it is a
264 * Redirect status. Now if we have 3 args, we expect that
265 * we were able to understand that 1st argument (it's something
266 * we expected, so if not, then we bail
267 */
268 if (!strcasecmp(arg1, "permanent"))
270 else if (!strcasecmp(arg1, "temp"))
272 else if (!strcasecmp(arg1, "seeother"))
274 else if (!strcasecmp(arg1, "gone")) {
276 grokarg1 = -1;
277 }
278 else if (apr_isdigit(*arg1)) {
279 status = atoi(arg1);
281 grokarg1 = -1;
282 }
283 }
284 else {
285 grokarg1 = 0;
286 }
287
288 if (arg3 && !grokarg1)
289 return "Redirect: invalid first argument (of three)";
290
291 /*
292 * if we have the 2nd arg and we understand the 1st one as a redirect
293 * status (3xx, but not things like 404 /robots.txt), or if we have the
294 * 1st arg but don't understand it, we use the expression syntax assuming
295 * a path from the location.
296 *
297 * if we understand the first arg but have no second arg, we are dealing
298 * with a status like "GONE" or a non-redirect status (e.g. 404, 503).
299 */
300 if (!cmd->path) {
301 /* <Location> context only for now */
302 ;
303 }
304 else if ((grokarg1 > 0 && arg2 && !arg3) || (!grokarg1 && !arg2)) {
305 const char *expr_err = NULL;
306
307 url = grokarg1 ? arg2 : arg1;
308 dirconf->redirect =
310 &expr_err, NULL);
311 if (expr_err) {
312 return apr_pstrcat(cmd->temp_pool,
313 "Cannot parse redirect expression '", url, "': ", expr_err,
314 NULL);
315 }
316
317 dirconf->redirect_status = status;
318 dirconf->redirect_set = 1;
319
320 return NULL;
321
322 }
323 else if (grokarg1 < 0 && !arg2) {
324
325 dirconf->redirect_status = status;
326 dirconf->redirect_set = 1;
327
328 return NULL;
329
330 }
331
332 /*
333 * if we don't have the 3rd arg and we didn't understand the 1st
334 * one, then assume URL-path URL. This also handles case, eg, GONE
335 * we even though we don't have a 3rd arg, we did understand the 1st
336 * one, so we don't want to re-arrange
337 */
338 if (!arg3 && !grokarg1) {
339 fake = arg1;
340 url = arg2;
341 }
342
343 if (use_regex) {
344 regex = ap_pregcomp(cmd->pool, fake, AP_REG_EXTENDED);
345 if (regex == NULL)
346 return "Regular expression could not be compiled.";
347 }
348
350 if (!url)
351 return "URL to redirect to is missing";
352 /* PR#35314: we can allow path components here;
353 * they get correctly resolved to full URLs.
354 */
355 if (!use_regex && !ap_is_url(url) && (url[0] != '/'))
356 return "Redirect to non-URL";
357 }
358 else {
359 if (url)
360 return "Redirect URL not valid for this status";
361 }
362
363 if (cmd->path)
364 new = apr_array_push(dirconf->redirects);
365 else
366 new = apr_array_push(serverconf->redirects);
367
368 new->fake = fake;
369 new->real = url;
370 new->regexp = regex;
371 new->redir_status = status;
372 return NULL;
373}
374
375static const char *add_redirect(cmd_parms *cmd, void *dirconf,
376 const char *arg1, const char *arg2,
377 const char *arg3)
378{
380}
381
382static const char *add_redirect2(cmd_parms *cmd, void *dirconf,
383 const char *arg1, const char *arg2)
384{
386}
387
388static const char *add_redirect_regex(cmd_parms *cmd, void *dirconf,
389 const char *arg1, const char *arg2,
390 const char *arg3)
391{
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{
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) {
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 */
471 return found;
472
473 }
474
475 return NULL;
476}
477
478static char *try_redirect(request_rec *r, int *status)
479{
482
483 if (dirconf->redirect_set) {
485 const char *err = NULL;
486 char *found = "";
487
488 if (dirconf->redirect) {
489
491 ap_expr_str_exec(r, dirconf->redirect, &err));
492 if (err) {
494 "Can't evaluate redirect expression: %s", err);
495 return PREGSUB_ERROR;
496 }
497
499 /* Do not escape the query string or fragment. */
502 if (uri.query) {
503 found = apr_pstrcat(r->pool, found, "?", uri.query, NULL);
504 }
505 if (uri.fragment) {
506 found = apr_pstrcat(r->pool, found, "#", uri.fragment, NULL);
507 }
508
509 }
510
511 *status = dirconf->redirect_status;
512 return found;
513
514 }
515
516 return NULL;
517}
518
520 int is_redir, int *status)
521{
522 alias_entry *entries = (alias_entry *) aliases->elts;
524 char *found = NULL;
525 int i;
526
527 for (i = 0; i < aliases->nelts; ++i) {
528 alias_entry *alias = &entries[i];
529 int l;
530
531 if (alias->regexp) {
532 if (!ap_regexec(alias->regexp, r->uri, AP_MAX_REG_MATCH, regm, 0)) {
533 if (alias->real) {
534 found = ap_pregsub(r->pool, alias->real, r->uri,
536 if (found) {
537 if (is_redir) {
540 /* Do not escape the query string or fragment. */
544 if (uri.query) {
545 found = apr_pstrcat(r->pool, found, "?",
546 uri.query, NULL);
547 }
548 if (uri.fragment) {
549 found = apr_pstrcat(r->pool, found, "#",
550 uri.fragment, NULL);
551 }
552 }
553 }
554 else {
556 "Regex substitution in '%s' failed. "
557 "Replacement too long?", alias->real);
558 return PREGSUB_ERROR;
559 }
560 }
561 else {
562 /* need something non-null */
563 found = "";
564 }
565 }
566 }
567 else {
568 l = alias_matches(r->uri, alias->fake);
569
570 if (l > 0) {
571 ap_set_context_info(r, alias->fake, alias->real);
572 if (is_redir) {
573 char *escurl;
574 escurl = ap_os_escape_path(r->pool, r->uri + l, 1);
575
576 found = apr_pstrcat(r->pool, alias->real, escurl, NULL);
577 }
578 else
579 found = apr_pstrcat(r->pool, alias->real, r->uri + l, NULL);
580 }
581 }
582
583 if (found) {
584 if (alias->handler) { /* Set handler, and leave a note for mod_cgi */
585 r->handler = alias->handler;
586 apr_table_setn(r->notes, "alias-forced-type", r->handler);
587 }
588 /* XXX This is as SLOW as can be, next step, we optimize
589 * and merge to whatever part of the found path was already
590 * canonicalized. After I finish eliminating os canonical.
591 * Better fail test for ap_server_root_relative needed here.
592 */
593 if (!is_redir) {
595 }
596 if (found) {
597 *status = alias->redir_status;
598 }
599 return found;
600 }
601
602 }
603
604 return NULL;
605}
606
608{
611 char *ret;
612 int status;
613
614 if (r->uri[0] != '/' && r->uri[0] != '\0') {
615 return DECLINED;
616 }
617
618 if ((ret = try_redirect(r, &status)) != NULL
619 || (ret = try_alias_list(r, serverconf->redirects, 1, &status))
620 != NULL) {
621 if (ret == PREGSUB_ERROR)
625 ap_get_module_config(r->per_dir_config, &alias_module);
626 if (dirconf->allow_relative != ALIAS_FLAG_ON || ret[0] != '/') {
627 if (ret[0] == '/') {
628 char *orig_target = ret;
629
632 "incomplete redirection target of '%s' for "
633 "URI '%s' modified to '%s'",
634 orig_target, r->uri, ret);
635 }
636 if (!ap_is_url(ret)) {
638 "cannot redirect '%s' to '%s'; "
639 "target is not a valid absoluteURI or abs_path",
640 r->uri, ret);
642 }
643 }
644 /* append requested query only, if the config didn't
645 * supply its own.
646 */
647 if (r->args && !ap_strchr(ret, '?')) {
648 ret = apr_pstrcat(r->pool, ret, "?", r->args, NULL);
649 }
650 apr_table_setn(r->headers_out, "Location", ret);
651 }
652 return status;
653 }
654
655 if ((ret = try_alias(r)) != NULL
656 || (ret = try_alias_list(r, serverconf->aliases, 0, &status))
657 != NULL) {
658 r->filename = ret;
659 return OK;
660 }
661
662 return DECLINED;
663}
664
666{
667 void *dconf = r->per_dir_config;
669 (alias_dir_conf *) ap_get_module_config(dconf, &alias_module);
670 char *ret;
671 int status;
672
673 /* It may have changed since last time, so try again */
674
675 if ((ret = try_redirect(r, &status)) != NULL
676 || (ret = try_alias_list(r, dirconf->redirects, 1, &status))
677 != NULL) {
678 if (ret == PREGSUB_ERROR)
681 if (dirconf->allow_relative != ALIAS_FLAG_ON || ret[0] != '/') {
682 if (ret[0] == '/') {
683 char *orig_target = ret;
684
687 "incomplete redirection target of '%s' for "
688 "URI '%s' modified to '%s'",
689 orig_target, r->uri, ret);
690 }
691 if (!ap_is_url(ret)) {
693 "cannot redirect '%s' to '%s'; "
694 "target is not a valid absoluteURI or abs_path",
695 r->uri, ret);
697 }
698 }
699 /* append requested query only, if the config didn't
700 * supply its own.
701 */
702 if (r->args && !ap_strchr(ret, '?')) {
703 ret = apr_pstrcat(r->pool, ret, "?", r->args, NULL);
704 }
705 apr_table_setn(r->headers_out, "Location", ret);
706 }
707 return status;
708 }
709
710 return DECLINED;
711}
712
713static const command_rec alias_cmds[] =
714{
716 "a fakename and a realname, or a realname in a Location"),
717 AP_INIT_TAKE12("ScriptAlias", add_alias, "cgi-script", RSRC_CONF | ACCESS_CONF,
718 "a fakename and a realname, or a realname in a Location"),
721 "an optional status, then document to be redirected and "
722 "destination URL"),
724 "a regular expression and a filename"),
725 AP_INIT_TAKE2("ScriptAliasMatch", add_alias_regex, "cgi-script", RSRC_CONF,
726 "a regular expression and a filename"),
727 AP_INIT_TAKE23("RedirectMatch", add_redirect_regex,
729 "an optional status, then a regular expression and "
730 "destination URL"),
731 AP_INIT_TAKE2("RedirectTemp", add_redirect2,
733 "a document to be redirected, then the destination URL"),
734 AP_INIT_TAKE2("RedirectPermanent", add_redirect2,
736 "a document to be redirected, then the destination URL"),
737 AP_INIT_FLAG("RedirectRelative", ap_set_flag_slot,
738 (void*)APR_OFFSETOF(alias_dir_conf, allow_relative), OR_FILEINFO,
739 "Set to ON to allow relative redirect targets to be issued as-is"),
740 AP_INIT_FLAG("AliasPreservePath", ap_set_flag_slot,
741 (void*)APR_OFFSETOF(alias_dir_conf, alias_preserve_path), OR_FILEINFO,
742 "Set to ON to map the full path after the fakename to the realname."),
743
744 {NULL}
745};
746
747
749{
750 static const char * const aszSucc[]={ "mod_userdir.c",
751 "mod_vhost_alias.c",NULL };
752
755}
756
758{
760 create_alias_dir_config, /* dir config creater */
761 merge_alias_dir_config, /* dir merger --- default is to override */
762 create_alias_config, /* server config */
763 merge_alias_config, /* merge server configs */
764 alias_cmds, /* command apr_table_t */
765 register_hooks /* register hooks */
766};
Symbol export macros and hook functions.
Expression parser.
#define AP_REG_EXTENDED
Definition ap_regex.h:78
APR general purpose library routines.
apr_size_t const unsigned char unsigned int unsigned int d
Definition apr_siphash.h:72
APR Strings library.
apr_array_append(apr_pool_t *p, const apr_array_header_t *first, const apr_array_header_t *second)
Definition apr_tables.c:213
APR Standard Headers Support.
return found
Definition core.c:2840
#define AP_INIT_TAKE123(directive, func, mconfig, where, help)
#define ap_get_module_config(v, m)
struct ap_conf_vector_t ap_conf_vector_t
#define AP_DECLARE_MODULE(foo)
#define AP_INIT_FLAG(directive, func, mconfig, where, help)
ap_conf_vector_t * base
char * ap_server_root_relative(apr_pool_t *p, const char *fname)
Definition config.c:1594
#define AP_INIT_TAKE12(directive, func, mconfig, where, help)
const char * ap_set_flag_slot(cmd_parms *cmd, void *struct_ptr, int arg)
Definition config.c:1512
request_rec * r
#define AP_INIT_TAKE23(directive, func, mconfig, where, help)
#define AP_INIT_TAKE2(directive, func, mconfig, where, help)
#define AP_MAX_REG_MATCH
Definition httpd.h:309
#define DECLINED
Definition httpd.h:457
#define OK
Definition httpd.h:456
char * ap_construct_url(apr_pool_t *p, const char *uri, request_rec *r)
Definition core.c:1246
#define APLOGNO(n)
Definition http_log.h:117
#define ap_log_rerror
Definition http_log.h:454
#define APLOG_ERR
Definition http_log.h:67
#define ap_log_error
Definition http_log.h:370
#define APLOG_MARK
Definition http_log.h:283
#define APLOG_WARNING
Definition http_log.h:68
#define APLOG_DEBUG
Definition http_log.h:71
void ap_hook_translate_name(ap_HOOK_translate_name_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder)
Definition request.c:81
void ap_hook_fixups(ap_HOOK_fixups_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder)
Definition request.c:87
void * dummy
Definition http_vhost.h:62
apr_bucket apr_bucket_brigade * a
const char * url
Definition apr_escape.h:120
const char *const const char *const * aszSucc
Definition apr_hooks.h:346
#define APR_HOOK_MIDDLE
Definition apr_hooks.h:303
#define APR_URI_UNP_OMITQUERY
Definition apr_uri.h:77
const char * uri
Definition apr_uri.h:159
#define AP_EXPR_FLAG_STRING_RESULT
Definition ap_expr.h:68
#define ap_expr_parse_cmd(cmd, expr, flags, err, lookup_fn)
Definition ap_expr.h:340
const char * ap_expr_str_exec(request_rec *r, const ap_expr_info_t *expr, const char **err)
#define ACCESS_CONF
#define RSRC_CONF
#define OR_FILEINFO
#define HTTP_SEE_OTHER
Definition httpd.h:503
#define HTTP_INTERNAL_SERVER_ERROR
Definition httpd.h:535
#define HTTP_MOVED_TEMPORARILY
Definition httpd.h:502
#define ap_is_HTTP_REDIRECT(x)
Definition httpd.h:552
#define HTTP_MOVED_PERMANENTLY
Definition httpd.h:501
#define HTTP_GONE
Definition httpd.h:518
#define STANDARD20_MODULE_STUFF
#define ap_strchr(s, c)
Definition httpd.h:2351
int ap_is_url(const char *u)
Definition util.c:2377
#define ap_escape_uri(ppool, path)
Definition httpd.h:1836
void ap_set_context_info(request_rec *r, const char *prefix, const char *document_root)
Definition core.c:863
char * ap_pregsub(apr_pool_t *p, const char *input, const char *source, apr_size_t nmatch, ap_regmatch_t pmatch[])
Definition util.c:457
ap_regex_t * ap_pregcomp(apr_pool_t *p, const char *pattern, int cflags)
Definition util.c:262
char * ap_os_escape_path(apr_pool_t *p, const char *path, int partial)
Definition util.c:2073
#define NOT_IN_FILES
#define NOT_IN_DIRECTORY
#define NOT_IN_DIR_CONTEXT
const char * ap_check_cmd_context(cmd_parms *cmd, unsigned forbidden)
Definition core.c:1301
apr_size_t size
#define apr_isdigit(c)
Definition apr_lib.h:209
int strcasecmp(const char *a, const char *b)
#define apr_pcalloc(p, size)
Definition apr_pools.h:465
const char * s
Definition apr_strings.h:95
apr_int32_t apr_int32_t apr_int32_t err
apr_cmdtype_e cmd
int int status
Apache Configuration.
CORE HTTP Daemon.
Apache Logging library.
Apache Request library.
HTTP Daemon routines.
apr_pool_t * p
Definition md_event.c:32
static const char * add_redirect_regex(cmd_parms *cmd, void *dirconf, const char *arg1, const char *arg2, const char *arg3)
Definition mod_alias.c:388
static void * create_alias_dir_config(apr_pool_t *p, char *d)
Definition mod_alias.c:87
static char * try_redirect(request_rec *r, int *status)
Definition mod_alias.c:478
static int translate_alias_redir(request_rec *r)
Definition mod_alias.c:607
static char * try_alias(request_rec *r)
Definition mod_alias.c:434
static int alias_matches(const char *uri, const char *alias_fakename)
Definition mod_alias.c:395
static void * merge_alias_dir_config(apr_pool_t *p, void *basev, void *overridesv)
Definition mod_alias.c:109
static void * merge_alias_config(apr_pool_t *p, void *basev, void *overridesv)
Definition mod_alias.c:97
static const char * add_alias_regex(cmd_parms *cmd, void *dummy, const char *fake, const char *real)
Definition mod_alias.c:240
static const char * add_alias_internal(cmd_parms *cmd, void *dummy, const char *fake, const char *real, int use_regex)
Definition mod_alias.c:139
#define PREGSUB_ERROR
Definition mod_alias.c:75
static int fixup_redir(request_rec *r)
Definition mod_alias.c:665
static const command_rec alias_cmds[]
Definition mod_alias.c:713
static void register_hooks(apr_pool_t *p)
Definition mod_alias.c:748
#define ALIAS_FLAG_ON
Definition mod_alias.c:42
static char magic_error_value
Definition mod_alias.c:74
static char * try_alias_list(request_rec *r, apr_array_header_t *aliases, int is_redir, int *status)
Definition mod_alias.c:519
static const char * add_redirect_internal(cmd_parms *cmd, alias_dir_conf *dirconf, const char *arg1, const char *arg2, const char *arg3, int use_regex)
Definition mod_alias.c:246
static const char * add_alias(cmd_parms *cmd, void *dummy, const char *fake, const char *real)
Definition mod_alias.c:201
static void * create_alias_config(apr_pool_t *p, server_rec *s)
Definition mod_alias.c:77
#define ALIAS_FLAG_DEFAULT
Definition mod_alias.c:40
static const char * add_redirect2(cmd_parms *cmd, void *dirconf, const char *arg1, const char *arg2)
Definition mod_alias.c:382
static const char * add_redirect(cmd_parms *cmd, void *dirconf, const char *arg1, const char *arg2, const char *arg3)
Definition mod_alias.c:375
return NULL
Definition mod_so.c:359
int i
Definition mod_so.c:347
sconf
Definition mod_so.c:349
const ap_expr_info_t * alias
Definition mod_alias.c:63
unsigned int redirect_set
Definition mod_alias.c:61
unsigned int alias_set
Definition mod_alias.c:60
int redirect_status
Definition mod_alias.c:67
apr_array_header_t * redirects
Definition mod_alias.c:62
int alias_preserve_path
Definition mod_alias.c:69
char * handler
Definition mod_alias.c:65
const char * alias_fake
Definition mod_alias.c:64
const ap_expr_info_t * redirect
Definition mod_alias.c:66
Definition mod_alias.c:46
int redir_status
Definition mod_alias.c:51
ap_regex_t * regexp
Definition mod_alias.c:50
const char * real
Definition mod_alias.c:47
char * handler
Definition mod_alias.c:49
const char * fake
Definition mod_alias.c:48
apr_array_header_t * redirects
Definition mod_alias.c:56
apr_array_header_t * aliases
Definition mod_alias.c:55
A structure that represents the current request.
Definition httpd.h:845
char * uri
Definition httpd.h:1016
const char * handler
Definition httpd.h:994
apr_table_t * notes
Definition httpd.h:985
apr_pool_t * pool
Definition httpd.h:847
char * filename
Definition httpd.h:1018
server_rec * server
Definition httpd.h:851
struct ap_conf_vector_t * per_dir_config
Definition httpd.h:1047
char * args
Definition httpd.h:1026
apr_table_t * headers_out
Definition httpd.h:978
A structure to store information for each virtual server.
Definition httpd.h:1322
struct ap_conf_vector_t * module_config
Definition httpd.h:1341
#define regex
typedef int(WSAAPI *apr_winapi_fpt_WSAPoll)(IN OUT LPWSAPOLLFD fdArray