mod_rewrite.h revision edcf63bfe6b8d28907c7d9708bf2adfdb781790b
6ae232055d4d8a97267517c5e50074c2c819941and/* ====================================================================
6ae232055d4d8a97267517c5e50074c2c819941and * The Apache Software License, Version 1.1
6ae232055d4d8a97267517c5e50074c2c819941and * Copyright (c) 2000-2003 The Apache Software Foundation. All rights
6ae232055d4d8a97267517c5e50074c2c819941and * reserved.
6ae232055d4d8a97267517c5e50074c2c819941and * Redistribution and use in source and binary forms, with or without
3f08db06526d6901aa08c110b5bc7dde6bc39905nd * modification, are permitted provided that the following conditions
6ae232055d4d8a97267517c5e50074c2c819941and * are met:
6ae232055d4d8a97267517c5e50074c2c819941and * 1. Redistributions of source code must retain the above copyright
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen * notice, this list of conditions and the following disclaimer.
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen * 2. Redistributions in binary form must reproduce the above copyright
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen * notice, this list of conditions and the following disclaimer in
6ae232055d4d8a97267517c5e50074c2c819941and * the documentation and/or other materials provided with the
6ae232055d4d8a97267517c5e50074c2c819941and * distribution.
6ae232055d4d8a97267517c5e50074c2c819941and * 3. The end-user documentation included with the redistribution,
3f08db06526d6901aa08c110b5bc7dde6bc39905nd * if any, must include the following acknowledgment:
6ae232055d4d8a97267517c5e50074c2c819941and * "This product includes software developed by the
6ae232055d4d8a97267517c5e50074c2c819941and * Apache Software Foundation (http://www.apache.org/)."
6ae232055d4d8a97267517c5e50074c2c819941and * Alternately, this acknowledgment may appear in the software itself,
6ae232055d4d8a97267517c5e50074c2c819941and * if and wherever such third-party acknowledgments normally appear.
6ae232055d4d8a97267517c5e50074c2c819941and * 4. The names "Apache" and "Apache Software Foundation" must
6ae232055d4d8a97267517c5e50074c2c819941and * not be used to endorse or promote products derived from this
b43f840409794ed298e8634f6284741f193b6c4ftakashi * software without prior written permission. For written
ed1d958582984a7c54a6ca859e15939a414fa733nd * permission, please contact apache@apache.org.
6ae232055d4d8a97267517c5e50074c2c819941and * 5. Products derived from this software may not be called "Apache",
6ae232055d4d8a97267517c5e50074c2c819941and * nor may "Apache" appear in their name, without prior written
6ae232055d4d8a97267517c5e50074c2c819941and * permission of the Apache Software Foundation.
6ae232055d4d8a97267517c5e50074c2c819941and * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
d474d8ef01ec5c2a09341cd148851ed383c3287crbowen * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
d474d8ef01ec5c2a09341cd148851ed383c3287crbowen * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
6ae232055d4d8a97267517c5e50074c2c819941and * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
b43f840409794ed298e8634f6284741f193b6c4ftakashi * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
b43f840409794ed298e8634f6284741f193b6c4ftakashi * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
b43f840409794ed298e8634f6284741f193b6c4ftakashi * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
b43f840409794ed298e8634f6284741f193b6c4ftakashi * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
3f08db06526d6901aa08c110b5bc7dde6bc39905nd * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
6ae232055d4d8a97267517c5e50074c2c819941and * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
6ae232055d4d8a97267517c5e50074c2c819941and * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
6ae232055d4d8a97267517c5e50074c2c819941and * SUCH DAMAGE.
6ae232055d4d8a97267517c5e50074c2c819941and * ====================================================================
6ae232055d4d8a97267517c5e50074c2c819941and * This software consists of voluntary contributions made by many
6ae232055d4d8a97267517c5e50074c2c819941and * individuals on behalf of the Apache Software Foundation. For more
6ae232055d4d8a97267517c5e50074c2c819941and * information on the Apache Software Foundation, please see
6ae232055d4d8a97267517c5e50074c2c819941and * Portions of this software are based upon public domain software
6ae232055d4d8a97267517c5e50074c2c819941and * originally written at the National Center for Supercomputing Applications,
6ae232055d4d8a97267517c5e50074c2c819941and * University of Illinois, Urbana-Champaign.
6ae232055d4d8a97267517c5e50074c2c819941and** _ __ ___ ___ __| | _ __ _____ ___ __(_) |_ ___
6ae232055d4d8a97267517c5e50074c2c819941and** | '_ ` _ \ / _ \ / _` | | '__/ _ \ \ /\ / / '__| | __/ _ \
6ae232055d4d8a97267517c5e50074c2c819941and** | | | | | | (_) | (_| | | | | __/\ V V /| | | | || __/
6ae232055d4d8a97267517c5e50074c2c819941and** |_| |_| |_|\___/ \__,_|___|_| \___| \_/\_/ |_| |_|\__\___|
6ae232055d4d8a97267517c5e50074c2c819941and** URL Rewriting Module
6ae232055d4d8a97267517c5e50074c2c819941and** This module uses a rule-based rewriting engine (based on a
6ae232055d4d8a97267517c5e50074c2c819941and** regular-expression parser) to rewrite requested URLs on the fly.
6ae232055d4d8a97267517c5e50074c2c819941and** It supports an unlimited number of additional rule conditions (which can
6ae232055d4d8a97267517c5e50074c2c819941and** operate on a lot of variables, even on HTTP headers) for granular
6ae232055d4d8a97267517c5e50074c2c819941and** matching and even external database lookups (either via plain text
6ae232055d4d8a97267517c5e50074c2c819941and** tables, DBM hash files or even external processes) for advanced URL
5ae30adbe59946de742ab0cd6be3b7457471a698takashi** substitution.
6ae232055d4d8a97267517c5e50074c2c819941and** It operates on the full URLs (including the PATH_INFO part) both in
6ae232055d4d8a97267517c5e50074c2c819941and** per-server context (httpd.conf) and per-dir context (.htaccess) and even
6ae232055d4d8a97267517c5e50074c2c819941and** can generate QUERY_STRING parts on result. The rewriting result finally
6ae232055d4d8a97267517c5e50074c2c819941and** can lead to internal subprocessing, external request redirection or even
6ae232055d4d8a97267517c5e50074c2c819941and** to internal proxy throughput.
6ae232055d4d8a97267517c5e50074c2c819941and** This module was originally written in April 1996 and
6ae232055d4d8a97267517c5e50074c2c819941and** gifted exclusively to the The Apache Software Foundation in July 1997 by
6ae232055d4d8a97267517c5e50074c2c819941and** Ralf S. Engelschall
6ae232055d4d8a97267517c5e50074c2c819941and** rse@engelschall.com
6ae232055d4d8a97267517c5e50074c2c819941and /* Include from the underlaying Unix system ... */
#define CORE_PRIVATE
#include "httpd.h"
#include "http_config.h"
#include "http_request.h"
#include "http_core.h"
#include "http_log.h"
#include "http_vhost.h"
#ifndef FALSE
#define FALSE 0
#ifndef NO
#ifndef RAND_MAX
#ifndef LONG_STRING_LEN
char **argv;
typedef struct cacheentry {
char *key;
char *value;
} cacheentry;
typedef struct tlbentry {
int t[CACHE_TLB_COLS];
typedef struct cachelist {
char *resource;
} cachelist;
typedef struct cache {
#if APR_HAS_THREADS
} cache;
typedef struct backrefinfo {
char *source;
int nsub;
} backrefinfo;
void *dconf,
const char *option);
const char *name);
const char *a1);
const char *str);
char *str);
const char *str);
char *str);
server_rec *s);
char *perdir);
char *perdir);
static void rewrite_rand_init(void);
static int rewrite_rand(int l, int h);
char *key);
const char *subst);