mod_alias.c revision affb82a2d7fc07c1a862d800ef47af966b898768
2605N/A/* ==================================================================== 2605N/A * The Apache Software License, Version 1.1 * Copyright (c) 2000-2003 The Apache Software Foundation. All rights * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * 4. The names "Apache" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact apache@apache.org. * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * ==================================================================== * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * Portions of this software are based upon public domain software * originally written at the National Center for Supercomputing Applications, * University of Illinois, Urbana-Champaign. * Original by Rob McCool, rewritten in succession by David Robinson /* need prototype for overlap check */ const char *f,
const char *r,
/* XX r can NOT be relative to DocumentRoot here... compat bug. */ return "Regular expression could not be compiled.";
/* XXX This may be optimized, but we must know that new->real * exists. If so, we can dir merge later, trusing new->real * and just canonicalizing the remainder. Not till I finish * cleaning out the old ap_canonical stuff first. /* check for overlapping (Script)Alias directives * and throw a warning if found one "The %s directive at line %d will probably never " "match because it overlaps an earlier %sAlias%s.",
break;
/* one warning per alias should be sufficient */ return "Regular expression could not be compiled.";
return "URL to redirect to is missing";
return "Redirect to non-URL";
return "Redirect URL not valid for this status";
"a fakename and a realname"),
"a fakename and a realname"),
"an optional status, then document to be redirected and " "a regular expression and a filename"),
"a regular expression and a filename"),
"an optional status, then a regular expression and " "a document to be redirected, then the destination URL"),
"a document to be redirected, then the destination URL"),
/* any number of '/' in the alias matches any number in * the supplied URI, but there must be at least one... /* Other characters are compared literally */ /* Check last alias path component matched all the way */ /* Return number of characters from URI which matched (may be * greater than length of alias, since we may have matched /* Do not escape the query string or fragment. */ /* need something non-null */ if (p->
handler) {
/* Set handler, and leave a note for mod_cgi */ /* XXX This is as SLOW as can be, next step, we optimize * and merge to whatever part of the found path was already * canonicalized. After I finish eliminating os canonical. * Better fail test for ap_server_root_relative needed here. if (r->
uri[0] !=
'/' && r->
uri[0] !=
'\0') {
/* include QUERY_STRING if any */ /* It may have changed since last time, so try again */ "incomplete redirection target of '%s' for " "URI '%s' modified to '%s'",
"cannot redirect '%s' to '%s'; " "target is not a valid absoluteURI or abs_path",
/* append requested query only, if the config didn't