mod_rewrite.c revision fbb0028b28e73d0a78b21a7e8f0b1d75f349274c
60a4b2c422dcbb08a554fb193105c08da592718bpoirier/* ====================================================================
60a4b2c422dcbb08a554fb193105c08da592718bpoirier * The Apache Software License, Version 1.1
60a4b2c422dcbb08a554fb193105c08da592718bpoirier * Copyright (c) 2000 The Apache Software Foundation. All rights
60a4b2c422dcbb08a554fb193105c08da592718bpoirier * reserved.
60a4b2c422dcbb08a554fb193105c08da592718bpoirier * Redistribution and use in source and binary forms, with or without
96ad5d81ee4a2cc66a4ae19893efc8aa6d06fae7jailletc * modification, are permitted provided that the following conditions
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen * 1. Redistributions of source code must retain the above copyright
2e545ce2450a9953665f701bb05350f0d3f26275nd * notice, this list of conditions and the following disclaimer.
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen * 2. Redistributions in binary form must reproduce the above copyright
60a4b2c422dcbb08a554fb193105c08da592718bpoirier * notice, this list of conditions and the following disclaimer in
60a4b2c422dcbb08a554fb193105c08da592718bpoirier * the documentation and/or other materials provided with the
af33a4994ae2ff15bc67d19ff1a7feb906745bf8rbowen * distribution.
60a4b2c422dcbb08a554fb193105c08da592718bpoirier * 3. The end-user documentation included with the redistribution,
60a4b2c422dcbb08a554fb193105c08da592718bpoirier * if any, must include the following acknowledgment:
60a4b2c422dcbb08a554fb193105c08da592718bpoirier * "This product includes software developed by the
3f08db06526d6901aa08c110b5bc7dde6bc39905nd * Apache Software Foundation (http://www.apache.org/)."
60a4b2c422dcbb08a554fb193105c08da592718bpoirier * Alternately, this acknowledgment may appear in the software itself,
f086b4b402fa9a2fefc7dda85de2a3cc1cd0a654rjung * if and wherever such third-party acknowledgments normally appear.
60a4b2c422dcbb08a554fb193105c08da592718bpoirier * 4. The names "Apache" and "Apache Software Foundation" must
60a4b2c422dcbb08a554fb193105c08da592718bpoirier * not be used to endorse or promote products derived from this
60a4b2c422dcbb08a554fb193105c08da592718bpoirier * software without prior written permission. For written
b97ba9a0b0f1bdad0bd7b4c5cb32319c2976b0aftrawick * permission, please contact apache@apache.org.
a99c5d4cc3cab6a62b04d52000dbc22ce1fa2d94coar * 5. Products derived from this software may not be called "Apache",
b97ba9a0b0f1bdad0bd7b4c5cb32319c2976b0aftrawick * nor may "Apache" appear in their name, without prior written
b97ba9a0b0f1bdad0bd7b4c5cb32319c2976b0aftrawick * permission of the Apache Software Foundation.
b97ba9a0b0f1bdad0bd7b4c5cb32319c2976b0aftrawick * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
60a4b2c422dcbb08a554fb193105c08da592718bpoirier * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
60a4b2c422dcbb08a554fb193105c08da592718bpoirier * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
b97ba9a0b0f1bdad0bd7b4c5cb32319c2976b0aftrawick * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
60a4b2c422dcbb08a554fb193105c08da592718bpoirier * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
60a4b2c422dcbb08a554fb193105c08da592718bpoirier * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
60a4b2c422dcbb08a554fb193105c08da592718bpoirier * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
60a4b2c422dcbb08a554fb193105c08da592718bpoirier * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
60a4b2c422dcbb08a554fb193105c08da592718bpoirier * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
60a4b2c422dcbb08a554fb193105c08da592718bpoirier * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
60a4b2c422dcbb08a554fb193105c08da592718bpoirier * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
60a4b2c422dcbb08a554fb193105c08da592718bpoirier * SUCH DAMAGE.
9a58dc6a2b26ec128b1270cf48810e705f1a90dbsf * ====================================================================
60a4b2c422dcbb08a554fb193105c08da592718bpoirier * This software consists of voluntary contributions made by many
5cd08ee4a8f5a665e656f70048a1268a02bc0e73sf * individuals on behalf of the Apache Software Foundation. For more
5cd08ee4a8f5a665e656f70048a1268a02bc0e73sf * information on the Apache Software Foundation, please see
60a4b2c422dcbb08a554fb193105c08da592718bpoirier * Portions of this software are based upon public domain software
5cd08ee4a8f5a665e656f70048a1268a02bc0e73sf * originally written at the National Center for Supercomputing Applications,
5cd08ee4a8f5a665e656f70048a1268a02bc0e73sf * University of Illinois, Urbana-Champaign.
60a4b2c422dcbb08a554fb193105c08da592718bpoirier** _ __ ___ ___ __| | _ __ _____ ___ __(_) |_ ___
60a4b2c422dcbb08a554fb193105c08da592718bpoirier** | '_ ` _ \ / _ \ / _` | | '__/ _ \ \ /\ / / '__| | __/ _ \
60a4b2c422dcbb08a554fb193105c08da592718bpoirier** | | | | | | (_) | (_| | | | | __/\ V V /| | | | || __/
5cd08ee4a8f5a665e656f70048a1268a02bc0e73sf** |_| |_| |_|\___/ \__,_|___|_| \___| \_/\_/ |_| |_|\__\___|
60a4b2c422dcbb08a554fb193105c08da592718bpoirier** URL Rewriting Module
b97ba9a0b0f1bdad0bd7b4c5cb32319c2976b0aftrawick** This module uses a rule-based rewriting engine (based on a
5cd08ee4a8f5a665e656f70048a1268a02bc0e73sf** regular-expression parser) to rewrite requested URLs on the fly.
5cd08ee4a8f5a665e656f70048a1268a02bc0e73sf** It supports an unlimited number of additional rule conditions (which can
60a4b2c422dcbb08a554fb193105c08da592718bpoirier** operate on a lot of variables, even on HTTP headers) for granular
60a4b2c422dcbb08a554fb193105c08da592718bpoirier** matching and even external database lookups (either via plain text
60a4b2c422dcbb08a554fb193105c08da592718bpoirier** tables, DBM hash files or even external processes) for advanced URL
60a4b2c422dcbb08a554fb193105c08da592718bpoirier** substitution.
5cd08ee4a8f5a665e656f70048a1268a02bc0e73sf** It operates on the full URLs (including the PATH_INFO part) both in
5cd08ee4a8f5a665e656f70048a1268a02bc0e73sf** per-server context (httpd.conf) and per-dir context (.htaccess) and even
a04dcd330b05345681a4057702b2d43b2042e21dtrawick** can generate QUERY_STRING parts on result. The rewriting result finally
a04dcd330b05345681a4057702b2d43b2042e21dtrawick** can lead to internal subprocessing, external request redirection or even
a04dcd330b05345681a4057702b2d43b2042e21dtrawick** to internal proxy throughput.
f8b7daeb0e3f0ac4544fcc665de10c6b69a1ce0dsf** This module was originally written in April 1996 and
b97ba9a0b0f1bdad0bd7b4c5cb32319c2976b0aftrawick** gifted exclusively to the The Apache Software Foundation in July 1997 by
5cd08ee4a8f5a665e656f70048a1268a02bc0e73sf** Ralf S. Engelschall
5cd08ee4a8f5a665e656f70048a1268a02bc0e73sf** rse@engelschall.com
60a4b2c422dcbb08a554fb193105c08da592718bpoirier#if !defined(OS2) && !defined(WIN32) && !defined(BEOS)
a99c5d4cc3cab6a62b04d52000dbc22ce1fa2d94coar** +-------------------------------------------------------+
bcb2c4ef861e8f8260284631b6753e1088643c8asf** | static module configuration
bcb2c4ef861e8f8260284631b6753e1088643c8asf** +-------------------------------------------------------+
5cd08ee4a8f5a665e656f70048a1268a02bc0e73sf** Our interface to the Apache server kernel:
60a4b2c422dcbb08a554fb193105c08da592718bpoirier** o Runtime logic of a request is as following:
a99c5d4cc3cab6a62b04d52000dbc22ce1fa2d94coar** while(request or subrequest)
b97ba9a0b0f1bdad0bd7b4c5cb32319c2976b0aftrawick** foreach(stage #0...#9)
60a4b2c422dcbb08a554fb193105c08da592718bpoirier** foreach(module) (**)
b97ba9a0b0f1bdad0bd7b4c5cb32319c2976b0aftrawick** try to run hook
b97ba9a0b0f1bdad0bd7b4c5cb32319c2976b0aftrawick** o the order of modules at (**) is the inverted order as
5cd08ee4a8f5a665e656f70048a1268a02bc0e73sf** given in the "Configuration" file, i.e. the last module
b97ba9a0b0f1bdad0bd7b4c5cb32319c2976b0aftrawick** specified is the first one called for each hook!
57b31f30545668d28e895efe7f5c0eb15d37a03figalic** The core module is always the last!
d474d8ef01ec5c2a09341cd148851ed383c3287crbowen** o there are two different types of result checking and
d474d8ef01ec5c2a09341cd148851ed383c3287crbowen** continue processing:
d474d8ef01ec5c2a09341cd148851ed383c3287crbowen** for hook #0,#1,#4,#5,#6,#8:
b97ba9a0b0f1bdad0bd7b4c5cb32319c2976b0aftrawick** hook run loop stops on first modules which gives
0236ede61169f34359c234625a1d792b97d7db12nd** back a result != DECLINED, i.e. it usually returns OK
0236ede61169f34359c234625a1d792b97d7db12nd** which says "OK, module has handled this _stage_" and for #1
60a4b2c422dcbb08a554fb193105c08da592718bpoirier** this have not to mean "Ok, the filename is now valid".
5cd08ee4a8f5a665e656f70048a1268a02bc0e73sf** for hook #2,#3,#7,#9:
5cd08ee4a8f5a665e656f70048a1268a02bc0e73sf** all hooks are run, independend of result
60a4b2c422dcbb08a554fb193105c08da592718bpoirier** o at the last stage, the core module always
60a4b2c422dcbb08a554fb193105c08da592718bpoirier** - says "HTTP_BAD_REQUEST" if r->filename does not begin with "/"
60a4b2c422dcbb08a554fb193105c08da592718bpoirier** - prefix URL with document_root or replaced server_root
b97ba9a0b0f1bdad0bd7b4c5cb32319c2976b0aftrawick** with document_root and sets r->filename
5cd08ee4a8f5a665e656f70048a1268a02bc0e73sf** - always return a "OK" independed if the file really exists
a99c5d4cc3cab6a62b04d52000dbc22ce1fa2d94coar /* The section for the Configure script:
b97ba9a0b0f1bdad0bd7b4c5cb32319c2976b0aftrawick * XXX: this needs updating for apache-2.0 configuration method
b97ba9a0b0f1bdad0bd7b4c5cb32319c2976b0aftrawick * MODULE-DEFINITION-START
b97ba9a0b0f1bdad0bd7b4c5cb32319c2976b0aftrawick * Name: rewrite_module
a99c5d4cc3cab6a62b04d52000dbc22ce1fa2d94coar * ConfigStart
b97ba9a0b0f1bdad0bd7b4c5cb32319c2976b0aftrawick if [ "x$found_dbm" = "x1" ]; then
b97ba9a0b0f1bdad0bd7b4c5cb32319c2976b0aftrawick echo " enabling DBM support for mod_rewrite"
60a4b2c422dcbb08a554fb193105c08da592718bpoirier echo " disabling DBM support for mod_rewrite"
5cd08ee4a8f5a665e656f70048a1268a02bc0e73sf echo " (perhaps you need to add -ldbm, -lndbm or -lgdbm to EXTRA_LIBS)"
5cd08ee4a8f5a665e656f70048a1268a02bc0e73sf CFLAGS="$CFLAGS -DNO_DBM_REWRITEMAP"
60a4b2c422dcbb08a554fb193105c08da592718bpoirier * ConfigEnd
60a4b2c422dcbb08a554fb193105c08da592718bpoirier * MODULE-DEFINITION-END
b97ba9a0b0f1bdad0bd7b4c5cb32319c2976b0aftrawick /* the module (predeclaration) */
60a4b2c422dcbb08a554fb193105c08da592718bpoirier /* the cache */
60a4b2c422dcbb08a554fb193105c08da592718bpoirier /* whether proxy module is available or not */
5cd08ee4a8f5a665e656f70048a1268a02bc0e73sfstatic const char *lockname;
b97ba9a0b0f1bdad0bd7b4c5cb32319c2976b0aftrawick** +-------------------------------------------------------+
b97ba9a0b0f1bdad0bd7b4c5cb32319c2976b0aftrawick** | configuration directive handling
b97ba9a0b0f1bdad0bd7b4c5cb32319c2976b0aftrawick** +-------------------------------------------------------+
a99c5d4cc3cab6a62b04d52000dbc22ce1fa2d94coar** per-server configuration structure handling
60a4b2c422dcbb08a554fb193105c08da592718bpoirierstatic void *config_server_create(apr_pool_t *p, server_rec *s)
60a4b2c422dcbb08a554fb193105c08da592718bpoirier a = (rewrite_server_conf *)apr_pcalloc(p, sizeof(rewrite_server_conf));
b97ba9a0b0f1bdad0bd7b4c5cb32319c2976b0aftrawick a->rewritemaps = apr_array_make(p, 2, sizeof(rewritemap_entry));
5cd08ee4a8f5a665e656f70048a1268a02bc0e73sf a->rewriteconds = apr_array_make(p, 2, sizeof(rewritecond_entry));
5cd08ee4a8f5a665e656f70048a1268a02bc0e73sf a->rewriterules = apr_array_make(p, 2, sizeof(rewriterule_entry));
60a4b2c422dcbb08a554fb193105c08da592718bpoirier return (void *)a;
b6529ec5115d80b7dedcfd0935746015b2096084minfrinstatic void *config_server_merge(apr_pool_t *p, void *basev, void *overridesv)
b97ba9a0b0f1bdad0bd7b4c5cb32319c2976b0aftrawick a = (rewrite_server_conf *)apr_pcalloc(p, sizeof(rewrite_server_conf));
78f97ce162b66a0dbfd7af4dcd9984f162569b04minfrin * local directives override
b6529ec5115d80b7dedcfd0935746015b2096084minfrin * and anything else is inherited
b6529ec5115d80b7dedcfd0935746015b2096084minfrin a->rewriteloglevel = overrides->rewriteloglevel != 0
b6529ec5115d80b7dedcfd0935746015b2096084minfrin a->rewritelogfile = overrides->rewritelogfile != NULL
78f97ce162b66a0dbfd7af4dcd9984f162569b04minfrin a->rewritemaps = apr_array_append(p, overrides->rewritemaps,
78f97ce162b66a0dbfd7af4dcd9984f162569b04minfrin a->rewriteconds = apr_array_append(p, overrides->rewriteconds,
60a4b2c422dcbb08a554fb193105c08da592718bpoirier a->rewriterules = apr_array_append(p, overrides->rewriterules,
5cd08ee4a8f5a665e656f70048a1268a02bc0e73sf * local directives override
5cd08ee4a8f5a665e656f70048a1268a02bc0e73sf * and anything else gets defaults
a99c5d4cc3cab6a62b04d52000dbc22ce1fa2d94coar return (void *)a;
60a4b2c422dcbb08a554fb193105c08da592718bpoirier** per-directory configuration structure handling
5cd08ee4a8f5a665e656f70048a1268a02bc0e73sfstatic void *config_perdir_create(apr_pool_t *p, char *path)
60a4b2c422dcbb08a554fb193105c08da592718bpoirier a = (rewrite_perdir_conf *)apr_pcalloc(p, sizeof(rewrite_perdir_conf));
b97ba9a0b0f1bdad0bd7b4c5cb32319c2976b0aftrawick a->rewriteconds = apr_array_make(p, 2, sizeof(rewritecond_entry));
5cd08ee4a8f5a665e656f70048a1268a02bc0e73sf a->rewriterules = apr_array_make(p, 2, sizeof(rewriterule_entry));
b97ba9a0b0f1bdad0bd7b4c5cb32319c2976b0aftrawick /* make sure it has a trailing slash */
60a4b2c422dcbb08a554fb193105c08da592718bpoirier return (void *)a;
5cd08ee4a8f5a665e656f70048a1268a02bc0e73sfstatic void *config_perdir_merge(apr_pool_t *p, void *basev, void *overridesv)
5cd08ee4a8f5a665e656f70048a1268a02bc0e73sf a->rewriteconds = apr_array_append(p, overrides->rewriteconds,
50c04f297d76a57ead2fa6b73845f7563b1fc788sf a->rewriterules = apr_array_append(p, overrides->rewriterules,
33e4ab6c78a779cb3f72f7afed0fef9068f1b822trawick return (void *)a;
33e4ab6c78a779cb3f72f7afed0fef9068f1b822trawick** the configuration commands
33e4ab6c78a779cb3f72f7afed0fef9068f1b822trawick (rewrite_server_conf *)ap_get_module_config(cmd->server->module_config,
33e4ab6c78a779cb3f72f7afed0fef9068f1b822trawick sconf->state = (flag ? ENGINE_ENABLED : ENGINE_DISABLED);
33e4ab6c78a779cb3f72f7afed0fef9068f1b822trawick else /* is per-directory command */ {
33e4ab6c78a779cb3f72f7afed0fef9068f1b822trawick dconf->state = (flag ? ENGINE_ENABLED : ENGINE_DISABLED);
68e7d4f7d80c3e5ed94185cb28100bc786e4304atrawick const char *err;
68e7d4f7d80c3e5ed94185cb28100bc786e4304atrawick ap_get_module_config(cmd->server->module_config, &rewrite_module);
2d5f033e0b60accdc5c92470a71c6e9cd6c90803trawick else { /* is per-directory command */
2d5f033e0b60accdc5c92470a71c6e9cd6c90803trawickstatic const char *cmd_rewriteoptions_setoption(apr_pool_t *p, int *options,
2d5f033e0b60accdc5c92470a71c6e9cd6c90803trawick const char *name)
2d5f033e0b60accdc5c92470a71c6e9cd6c90803trawick return apr_pstrcat(p, "RewriteOptions: unknown option '",
2d5f033e0b60accdc5c92470a71c6e9cd6c90803trawickstatic const char *cmd_rewritelog(cmd_parms *cmd, void *dconf, const char *a1)
2d5f033e0b60accdc5c92470a71c6e9cd6c90803trawick ap_get_module_config(cmd->server->module_config, &rewrite_module);
2d5f033e0b60accdc5c92470a71c6e9cd6c90803trawickstatic const char *cmd_rewriteloglevel(cmd_parms *cmd, void *dconf, const char *a1)
9a58dc6a2b26ec128b1270cf48810e705f1a90dbsf ap_get_module_config(cmd->server->module_config, &rewrite_module);
2d5f033e0b60accdc5c92470a71c6e9cd6c90803trawickstatic const char *cmd_rewritemap(cmd_parms *cmd, void *dconf, const char *a1,
2d5f033e0b60accdc5c92470a71c6e9cd6c90803trawick const char *a2)
2d5f033e0b60accdc5c92470a71c6e9cd6c90803trawick ap_get_module_config(cmd->server->module_config, &rewrite_module);
2d5f033e0b60accdc5c92470a71c6e9cd6c90803trawick newmap->checkfile = apr_pstrcat(cmd->pool, a2+4, NDBM_FILE_SUFFIX, NULL);
2d5f033e0b60accdc5c92470a71c6e9cd6c90803trawick return apr_pstrdup(cmd->pool, "RewriteMap: cannot use NDBM mapfile, "
2d5f033e0b60accdc5c92470a71c6e9cd6c90803trawick "because no NDBM support is compiled in");
2d5f033e0b60accdc5c92470a71c6e9cd6c90803trawick return apr_pstrcat(cmd->pool, "RewriteMap: internal map not found:",
8cef90cad1b259d4a94f6095aa30439c60549a5drbowen if (newmap->checkfile && (sconf->state == ENGINE_ENABLED)
46fc29754beed5aa71b9dd9a69a85cc840b307f8minfrin "RewriteMap: map file or program not found:",
b97ba9a0b0f1bdad0bd7b4c5cb32319c2976b0aftrawickstatic const char *cmd_rewritelock(cmd_parms *cmd, void *dconf, const char *a1)
9cb641b95a976f28161ff3eb5dc71105a8f75ddeminfrin const char *error;
46fc29754beed5aa71b9dd9a69a85cc840b307f8minfrin if ((error = ap_check_cmd_context(cmd, GLOBAL_ONLY)) != NULL)
46fc29754beed5aa71b9dd9a69a85cc840b307f8minfrinstatic const char *cmd_rewritebase(cmd_parms *cmd, void *in_dconf,
46fc29754beed5aa71b9dd9a69a85cc840b307f8minfrin const char *a1)
2d5f033e0b60accdc5c92470a71c6e9cd6c90803trawick return "RewriteBase: only valid in per-directory config files";
2d5f033e0b60accdc5c92470a71c6e9cd6c90803trawick return "RewriteBase: empty URL not allowed";
2d5f033e0b60accdc5c92470a71c6e9cd6c90803trawick return "RewriteBase: argument is not a valid URL";
2d5f033e0b60accdc5c92470a71c6e9cd6c90803trawickstatic const char *cmd_rewritecond(cmd_parms *cmd, void *in_dconf,
2d5f033e0b60accdc5c92470a71c6e9cd6c90803trawick const char *in_str)
2d5f033e0b60accdc5c92470a71c6e9cd6c90803trawick const char *err;
2d5f033e0b60accdc5c92470a71c6e9cd6c90803trawick ap_get_module_config(cmd->server->module_config, &rewrite_module);
2d5f033e0b60accdc5c92470a71c6e9cd6c90803trawick /* make a new entry in the internal temporary rewrite rule list */
4e3e4fcc70d6f02d1b8bbda4f7155f9b103773a6trawick else { /* is per-directory command */
4e3e4fcc70d6f02d1b8bbda4f7155f9b103773a6trawick /* parse the argument line ourself */
4e3e4fcc70d6f02d1b8bbda4f7155f9b103773a6trawick return apr_pstrcat(cmd->pool, "RewriteCond: bad argument line '", str,
5cd08ee4a8f5a665e656f70048a1268a02bc0e73sf /* arg1: the input string */
60a4b2c422dcbb08a554fb193105c08da592718bpoirier /* arg3: optional flags field
f086b4b402fa9a2fefc7dda85de2a3cc1cd0a654rjung (this have to be first parsed, because we need to
727872d18412fc021f03969b8641810d8896820bhumbedooh know if the regex should be compiled with ICASE!) */
cc7e1025de9ac63bd4db6fe7f71c158b2cf09fe4humbedooh if ((err = cmd_rewritecond_parseflagfield(cmd->pool, newcond,
0d0ba3a410038e179b695446bb149cce6264e0abnd /* arg2: the pattern
ac082aefa89416cbdc9a1836eaf3bed9698201c8humbedooh try to compile the regexp to test if is ok */
30471a4650391f57975f60bbb6e4a90be7b284bfhumbedooh /* now be careful: Under the POSIX regex library
205f749042ed530040a4f0080dbcb47ceae8a374rjung we can compile the pattern for case insensitive matching,
af33a4994ae2ff15bc67d19ff1a7feb906745bf8rbowen under the old V8 library we have to do it self via a hack */
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd rc = ((regexp = ap_pregcomp(cmd->pool, cp, REG_EXTENDED|REG_ICASE))
if (rc) {
return NULL;
char *str)
char *cp;
char *cp1;
char *cp2;
char *cp3;
char *key;
char *val;
const char *err;
return err;
return NULL;
return NULL;
const char *in_str)
char *a1;
char *a2;
char *a3;
char *cp;
const char *err;
int mode;
return err;
cp++;
sizeof(rewritecond_entry));
sizeof(rewritecond_entry));
return NULL;
char *str)
char *cp;
char *cp1;
char *cp2;
char *cp3;
char *key;
char *val;
const char *err;
return err;
return NULL;
int status = 0;
if (i < MAX_ENV_FLAGS) {
return NULL;
server_rec *s)
void *data;
int first_time = 0;
if (!data) {
rewritelock_create(s, p);
for (; s; s = s->next) {
open_rewritelog(s, p);
if (!first_time)
run_rewritemap_programs(s, p);
void *sconf;
const char *var;
const char *thisserver;
char *thisport;
const char *thisurl;
const char *ccp;
unsigned int port;
return DECLINED;
return DECLINED;
r->filename);
if (!proxy_available) {
return HTTP_FORBIDDEN;
r->filename);
return OK;
n = r->status;
return HTTP_FORBIDDEN;
return HTTP_GONE;
return DECLINED;
#if APR_HAS_USER
return HTTP_BAD_REQUEST;
(r->filename +
r->filename);
return OK;
return DECLINED;
if (t == NULL) {
return DECLINED;
r->filename, t);
r->content_type = t;
return OK;
char *cp;
char *cp2;
const char *ccp;
char *prefix;
char *ofilename;
return DECLINED;
return DECLINED;
return DECLINED;
return HTTP_FORBIDDEN;
return DECLINED;
return OK;
n = r->status;
return HTTP_FORBIDDEN;
return HTTP_GONE;
return HTTP_BAD_REQUEST;
return OK;
r->filename+l);
return OK;
return DECLINED;
return DECLINED;
return DECLINED;
return OK;
char *perdir)
int changed;
int rc;
changed = 0;
loop:
p = &entries[i];
if (rc) {
goto loop;
if (p->skip > 0) {
s = p->skip;
p = &entries[i];
p = &entries[i];
return changed;
char *perdir)
char *uri;
char *output;
const char *vary;
int prefixstrip;
int failed;
int rc;
prefixstrip = 0;
sizeof(regmatch));
failed = 0;
c = &conds[i];
if (rc == 0) {
c = &conds[i];
if (rc == 0) {
if (failed) {
p->forced_mimetype);
reduce_uri(r);
r->filename);
p->forced_mimetype);
int rc;
rc = 0;
#if !defined(OS2)
sizeof(regmatch));
return rc;
char *endp;
goto skip;
goto skip;
if (result) {
char *var;
span = 0;
skip:
space--;
char *olduri;
if (q != NULL) {
if (qsappend) {
r->filename);
char *cp;
unsigned short port;
char *portp;
char *hostp;
char *url;
char *olduri;
c = *cp;
*cp = c;
const char *thisserver;
char *thisport;
int port;
#if APR_HAS_USER
char *newuri;
char *homedir;
return newuri;
void *sconf;
rewritemap_entry *s;
char *value;
s = &entries[i];
return NULL;
if ((value =
return value;
return NULL;
#ifndef NO_DBM_REWRITEMAP
return NULL;
if ((value =
return value;
return NULL;
return NULL;
if ((value =
return value;
return value;
return NULL;
if ((value =
return NULL;
return value;
return NULL;
char *cpT;
char *curkey;
char *curval;
return NULL;
if (skip == 0)
++cpT;
if (skip == 0)
return value;
#ifndef NO_DBM_REWRITEMAP
return value;
#ifndef NO_WRITEV
return NULL;
if (rewrite_mapr_lock_aquire) {
#ifdef NO_WRITEV
buf[i++] = c;
if (rewrite_mapr_lock_aquire) {
return NULL;
char *key)
cp++) {
return value;
cp++) {
return value;
char *value;
return value;
char *value;
return value;
static int rewrite_rand_init_done = 0;
static void rewrite_rand_init(void)
if (!rewrite_rand_init_done) {
static int rewrite_rand(int l, int h)
char *buf;
return value;
return buf;
const char *fname;
char *str1;
char *ruser;
const char *rhost;
(unsigned long)(r->server), (unsigned long)r,
return APR_SUCCESS;
#ifdef SIGHUP
!= APR_SUCCESS) ||
if (fpin) {
if (fpout) {
if (fperr) {
return (rc);
const char *result;
/* XXX: wow this has gotta be slow if you actually use it for a lot, recalculates exploded time for each variable */
return (char *)result; \
return NULL;
cache *c;
return NULL;
return NULL;
return NULL;
return NULL;
return n % CACHE_TLB_ROWS;
char *key)
for (i=0; i < CACHE_TLB_COLS; ++i) {
return NULL;
return &elt[j];
return NULL;
cacheentry *e)
cachelist *l;
cacheentry *e;
cachetlbentry *t;
int found_list;
found_list = 0;
if (e != NULL) {
if (!found_list) {
sizeof(cachetlbentry));
for (i=0; i<CACHE_TLB_ROWS; ++i) {
for (j=0; j<CACHE_TLB_COLS; ++j)
cachelist *l;
cacheentry *e;
if (e != NULL)
return NULL;
const char *subst)
char *output;
return output;
char *cp;
int isquoted;
cp++; \
isquoted = 0; \
cp++; \
cp++; \
char *cp;
char *cp;
for (i = 0; i < n1; i++) {
int depth;
else if (*s == left) {
++depth;
return NULL;
int depth;
return NULL;
else if (*s == left) {
++depth;
return NULL;
#ifdef NETWARE
{ NULL }