mod_rewrite.h revision 0f081398cf0eef8cc7c66a535d450110a92dc8ae
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding/* ====================================================================
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * Copyright (c) 1996-1999 The Apache Group. All rights reserved.
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding *
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * Redistribution and use in source and binary forms, with or without
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * modification, are permitted provided that the following conditions
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * are met:
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding *
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * 1. Redistributions of source code must retain the above copyright
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * notice, this list of conditions and the following disclaimer.
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding *
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * 2. Redistributions in binary form must reproduce the above copyright
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * notice, this list of conditions and the following disclaimer in
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * the documentation and/or other materials provided with the
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * distribution.
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding *
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * 3. All advertising materials mentioning features or use of this
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * software must display the following acknowledgment:
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * "This product includes software developed by the Apache Group
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * for use in the Apache HTTP server project (http://www.apache.org/)."
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding *
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * 4. The names "Apache Server" and "Apache Group" must not be used to
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * endorse or promote products derived from this software without
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * prior written permission. For written permission, please contact
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * apache@apache.org.
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding *
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * 5. Products derived from this software may not be called "Apache"
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * nor may "Apache" appear in their names without prior written
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * permission of the Apache Group.
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding *
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * 6. Redistributions of any form whatsoever must retain the following
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * acknowledgment:
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * "This product includes software developed by the Apache Group
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * for use in the Apache HTTP server project (http://www.apache.org/)."
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding *
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * OF THE POSSIBILITY OF SUCH DAMAGE.
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * ====================================================================
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding *
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * This software consists of voluntary contributions made by many
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * individuals on behalf of the Apache Group and was originally based
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * on public domain software written at the National Center for
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * Supercomputing Applications, University of Illinois, Urbana-Champaign.
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * For more information on the Apache Group and the Apache HTTP server
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * project, please see <http://www.apache.org/>.
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding *
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding */
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#ifndef _MOD_REWRITE_H
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define _MOD_REWRITE_H 1
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding/*
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding** _ _ _
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding** _ __ ___ ___ __| | _ __ _____ ___ __(_) |_ ___
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding** | '_ ` _ \ / _ \ / _` | | '__/ _ \ \ /\ / / '__| | __/ _ \
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding** | | | | | | (_) | (_| | | | | __/\ V V /| | | | || __/
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding** |_| |_| |_|\___/ \__,_|___|_| \___| \_/\_/ |_| |_|\__\___|
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding** |_____|
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding**
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding** URL Rewriting Module
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding**
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding** This module uses a rule-based rewriting engine (based on a
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding** regular-expression parser) to rewrite requested URLs on the fly.
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding**
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding** It supports an unlimited number of additional rule conditions (which can
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding** operate on a lot of variables, even on HTTP headers) for granular
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding** matching and even external database lookups (either via plain text
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding** tables, DBM hash files or even external processes) for advanced URL
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding** substitution.
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding**
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding** It operates on the full URLs (including the PATH_INFO part) both in
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding** per-server context (httpd.conf) and per-dir context (.htaccess) and even
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding** can generate QUERY_STRING parts on result. The rewriting result finally
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding** can lead to internal subprocessing, external request redirection or even
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding** to internal proxy throughput.
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding**
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding** This module was originally written in April 1996 and
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding** gifted exclusively to the The Apache Group in July 1997 by
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding**
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding** Ralf S. Engelschall
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding** rse@engelschall.com
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding** www.engelschall.com
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding*/
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding /* Include from the underlaying Unix system ... */
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#include <string.h>
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#include <stdarg.h>
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#include <stdlib.h>
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#include <time.h>
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#include <signal.h>
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#include <errno.h>
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#include <ctype.h>
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#include <sys/types.h>
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#include <sys/stat.h>
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding /* Include from the Apache server ... */
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define CORE_PRIVATE
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#include "httpd.h"
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#include "http_config.h"
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#include "http_conf_globals.h"
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#include "http_request.h"
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#include "http_core.h"
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#include "http_log.h"
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#include "http_vhost.h"
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding /*
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * The key in the r->notes table wherein we store our accumulated
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * Vary values, and the one used for per-condition checks in a chain.
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding */
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define VARY_KEY "rewrite-Vary"
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define VARY_KEY_THIS "rewrite-Vary-this"
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding /* The NDBM support:
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * We support only NDBM files.
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * But we have to stat the file for the mtime,
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * so we also need to know the file extension
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding */
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#ifndef NO_DBM_REWRITEMAP
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#if defined(__GLIBC__) && defined(__GLIBC_MINOR__) \
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#include <db1/ndbm.h>
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#else
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#include <ndbm.h>
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#endif
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#if defined(DBM_SUFFIX)
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define NDBM_FILE_SUFFIX DBM_SUFFIX
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#elif defined(__FreeBSD__) || (defined(DB_LOCK) && defined(DB_SHMEM))
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define NDBM_FILE_SUFFIX ".db"
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#else
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define NDBM_FILE_SUFFIX ".pag"
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#endif
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#endif
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding /* The locking support:
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * Try to determine whether we should use fcntl() or flock().
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * Would be better ap_config.h could provide this... :-(
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding */
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#if defined(USE_FCNTL_SERIALIZED_ACCEPT)
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define USE_FCNTL 1
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#include <fcntl.h>
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#endif
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#if defined(USE_FLOCK_SERIALIZED_ACCEPT)
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define USE_FLOCK 1
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#include <sys/file.h>
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#endif
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#if !defined(USE_FCNTL) && !defined(USE_FLOCK)
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define USE_FLOCK 1
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#if !defined(MPE) && !defined(WIN32) && !defined(__TANDEM)
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#include <sys/file.h>
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#endif
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#ifndef LOCK_UN
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#undef USE_FLOCK
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define USE_FCNTL 1
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#include <fcntl.h>
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#endif
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#endif
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#ifdef AIX
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#undef USE_FLOCK
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define USE_FCNTL 1
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#include <fcntl.h>
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#endif
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#ifdef WIN32
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#undef USE_FCNTL
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define USE_LOCKING
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#include <sys/locking.h>
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#endif
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding/*
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding**
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding** Some defines
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding**
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding*/
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define ENVVAR_SCRIPT_URL "SCRIPT_URL"
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define ENVVAR_SCRIPT_URI "SCRIPT_URI"
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#ifndef SUPPORT_DBM_REWRITEMAP
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define SUPPORT_DBM_REWRITEMAP 0
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#endif
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define REWRITE_FORCED_MIMETYPE_NOTEVAR "rewrite-forced-mimetype"
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define CONDFLAG_NONE 1<<0
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define CONDFLAG_NOCASE 1<<1
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define CONDFLAG_NOTMATCH 1<<2
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define CONDFLAG_ORNEXT 1<<3
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define RULEFLAG_NONE 1<<0
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define RULEFLAG_FORCEREDIRECT 1<<1
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define RULEFLAG_LASTRULE 1<<2
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define RULEFLAG_NEWROUND 1<<3
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define RULEFLAG_CHAIN 1<<4
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define RULEFLAG_IGNOREONSUBREQ 1<<5
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define RULEFLAG_NOTMATCH 1<<6
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define RULEFLAG_PROXY 1<<7
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define RULEFLAG_PASSTHROUGH 1<<8
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define RULEFLAG_FORBIDDEN 1<<9
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define RULEFLAG_GONE 1<<10
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define RULEFLAG_QSAPPEND 1<<11
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define RULEFLAG_NOCASE 1<<12
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define MAPTYPE_TXT 1<<0
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define MAPTYPE_DBM 1<<1
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define MAPTYPE_PRG 1<<2
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define MAPTYPE_INT 1<<3
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define MAPTYPE_RND 1<<4
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define ENGINE_DISABLED 1<<0
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define ENGINE_ENABLED 1<<1
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define OPTION_NONE 1<<0
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define OPTION_INHERIT 1<<1
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define CACHEMODE_TS 1<<0
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define CACHEMODE_TTL 1<<1
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define CACHE_TLB_ROWS 1024
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define CACHE_TLB_COLS 4
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#ifndef FALSE
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define FALSE 0
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define TRUE !FALSE
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#endif
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#ifndef NO
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define NO FALSE
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define YES TRUE
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#endif
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#ifndef RAND_MAX
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define RAND_MAX 32767
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#endif
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#ifndef LONG_STRING_LEN
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define LONG_STRING_LEN 2048
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#endif
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define MAX_ENV_FLAGS 15
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define MAX_NMATCH 10
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding/*
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding**
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding** our private data structures we handle with
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding**
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding*/
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding /* the list structures for holding the mapfile information
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * and the rewrite rules
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding */
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingtypedef struct {
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding char *name; /* the name of the map */
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding char *datafile; /* filename for map data files */
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding char *checkfile; /* filename to check for map existence */
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding int type; /* the type of the map */
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding int fpin; /* in file pointer for program maps */
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding int fpout; /* out file pointer for program maps */
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding int fperr; /* err file pointer for program maps */
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding char *(*func)(request_rec *, /* function pointer for internal maps */
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding char *);
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding} rewritemap_entry;
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingtypedef struct {
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding char *input; /* Input string of RewriteCond */
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding char *pattern; /* the RegExp pattern string */
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding regex_t *regexp;
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding int flags; /* Flags which control the match */
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding} rewritecond_entry;
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingtypedef struct {
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding array_header *rewriteconds; /* the corresponding RewriteCond entries */
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding char *pattern; /* the RegExp pattern string */
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding regex_t *regexp; /* the RegExp pattern compilation */
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding char *output; /* the Substitution string */
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding int flags; /* Flags which control the substitution */
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding char *forced_mimetype; /* forced MIME type of substitution */
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding int forced_responsecode; /* forced HTTP redirect response status */
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding char *env[MAX_ENV_FLAGS+1]; /* added environment variables */
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding int skip; /* number of next rules to skip */
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding} rewriterule_entry;
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding /* the per-server or per-virtual-server configuration
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * statically generated once on startup for every server
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding */
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingtypedef struct {
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding int state; /* the RewriteEngine state */
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding int options; /* the RewriteOption state */
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding char *rewritelogfile; /* the RewriteLog filename */
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding int rewritelogfp; /* the RewriteLog open filepointer */
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding int rewriteloglevel; /* the RewriteLog level of verbosity */
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding array_header *rewritemaps; /* the RewriteMap entries */
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding array_header *rewriteconds; /* the RewriteCond entries (temporary) */
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding array_header *rewriterules; /* the RewriteRule entries */
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding server_rec *server; /* the corresponding server indicator */
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding} rewrite_server_conf;
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding /* the per-directory configuration
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * generated on-the-fly by Apache server for current request
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding */
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingtypedef struct {
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding int state; /* the RewriteEngine state */
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding int options; /* the RewriteOption state */
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding array_header *rewriteconds; /* the RewriteCond entries (temporary) */
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding array_header *rewriterules; /* the RewriteRule entries */
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding char *directory; /* the directory where it applies */
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding char *baseurl; /* the base-URL where it applies */
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding} rewrite_perdir_conf;
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding /* the cache structures,
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * a 4-way hash table with LRU functionality
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding */
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingtypedef struct cacheentry {
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding time_t time;
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding char *key;
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding char *value;
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding} cacheentry;
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingtypedef struct tlbentry {
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding int t[CACHE_TLB_COLS];
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding} cachetlbentry;
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingtypedef struct cachelist {
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding char *resource;
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding array_header *entries;
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding array_header *tlb;
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding} cachelist;
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingtypedef struct cache {
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding pool *pool;
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding array_header *lists;
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding} cache;
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding /* the regex structure for the
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * substitution of backreferences
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding */
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingtypedef struct backrefinfo {
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding char *source;
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding int nsub;
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding regmatch_t regmatch[10];
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding} backrefinfo;
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding/*
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding**
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding** forward declarations
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding**
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding*/
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding /* config structure handling */
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic void *config_server_create(pool *p, server_rec *s);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic void *config_server_merge (pool *p, void *basev, void *overridesv);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic void *config_perdir_create(pool *p, char *path);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic void *config_perdir_merge (pool *p, void *basev, void *overridesv);
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding /* config directive handling */
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic const char *cmd_rewriteengine(cmd_parms *cmd,
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding rewrite_perdir_conf *dconf, int flag);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic const char *cmd_rewriteoptions(cmd_parms *cmd,
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding rewrite_perdir_conf *dconf,
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding char *option);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic const char *cmd_rewriteoptions_setoption(pool *p, int *options,
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding char *name);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic const char *cmd_rewritelog (cmd_parms *cmd, void *dconf, char *a1);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic const char *cmd_rewriteloglevel(cmd_parms *cmd, void *dconf, char *a1);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic const char *cmd_rewritemap (cmd_parms *cmd, void *dconf, char *a1,
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding char *a2);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic const char *cmd_rewritelock(cmd_parms *cmd, void *dconf, char *a1);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic const char *cmd_rewritebase(cmd_parms *cmd, rewrite_perdir_conf *dconf,
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding char *a1);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic const char *cmd_rewritecond(cmd_parms *cmd, rewrite_perdir_conf *dconf,
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding char *str);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic const char *cmd_rewritecond_parseflagfield(pool *p,
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding rewritecond_entry *new,
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding char *str);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic const char *cmd_rewritecond_setflag(pool *p, rewritecond_entry *cfg,
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding char *key, char *val);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic const char *cmd_rewriterule(cmd_parms *cmd, rewrite_perdir_conf *dconf,
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding char *str);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic const char *cmd_rewriterule_parseflagfield(pool *p,
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding rewriterule_entry *new,
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding char *str);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic const char *cmd_rewriterule_setflag(pool *p, rewriterule_entry *cfg,
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding char *key, char *val);
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding /* initialisation */
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic void init_module(server_rec *s, pool *p);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic void init_child(server_rec *s, pool *p);
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding /* runtime hooks */
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic int hook_uri2file (request_rec *r);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic int hook_mimetype (request_rec *r);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic int hook_fixup (request_rec *r);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic int handler_redirect(request_rec *r);
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding /* rewriting engine */
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic int apply_rewrite_list(request_rec *r, array_header *rewriterules,
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding char *perdir);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic int apply_rewrite_rule(request_rec *r, rewriterule_entry *p,
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding char *perdir);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic int apply_rewrite_cond(request_rec *r, rewritecond_entry *p,
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding char *perdir, backrefinfo *briRR,
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding backrefinfo *briRC);
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding /* URI transformation function */
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic void splitout_queryargs(request_rec *r, int qsappend);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic void fully_qualify_uri(request_rec *r);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic void reduce_uri(request_rec *r);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic void expand_backref_inbuffer(pool *p, char *buf, int nbuf,
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding backrefinfo *bri, char c);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic char *expand_tildepaths(request_rec *r, char *uri);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic void expand_map_lookups(request_rec *r, char *uri, int uri_len);
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding /* rewrite map support functions */
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic char *lookup_map(request_rec *r, char *name, char *key);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic char *lookup_map_txtfile(request_rec *r, char *file, char *key);
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#ifndef NO_DBM_REWRITEMAP
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic char *lookup_map_dbmfile(request_rec *r, char *file, char *key);
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#endif
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic char *lookup_map_program(request_rec *r, int fpin,
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding int fpout, char *key);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic char *lookup_map_internal(request_rec *r,
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding char *(*func)(request_rec *r, char *key),
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding char *key);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic char *rewrite_mapfunc_toupper(request_rec *r, char *key);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic char *rewrite_mapfunc_tolower(request_rec *r, char *key);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic char *rewrite_mapfunc_escape(request_rec *r, char *key);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic char *rewrite_mapfunc_unescape(request_rec *r, char *key);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic char *select_random_value_part(request_rec *r, char *value);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic void rewrite_rand_init(void);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic int rewrite_rand(int l, int h);
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding /* rewriting logfile support */
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic void open_rewritelog(server_rec *s, pool *p);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic void rewritelog(request_rec *r, int level, const char *text, ...)
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding __attribute__((format(printf,3,4)));
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic char *current_logtime(request_rec *r);
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding /* rewriting lockfile support */
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic void rewritelock_create(server_rec *s, pool *p);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic void rewritelock_open(server_rec *s, pool *p);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic void rewritelock_remove(void *data);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic void rewritelock_alloc(request_rec *r);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic void rewritelock_free(request_rec *r);
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding /* program map support */
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic void run_rewritemap_programs(server_rec *s, pool *p);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic int rewritemap_program_child(void *cmd, child_info *pinfo);
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding /* env variable support */
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic void expand_variables_inbuffer(request_rec *r, char *buf, int buf_len);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic char *expand_variables(request_rec *r, char *str);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic char *lookup_variable(request_rec *r, char *var);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic char *lookup_header(request_rec *r, const char *name);
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding /* caching functions */
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic cache *init_cache(pool *p);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic char *get_cache_string(cache *c, char *res, int mode, time_t mtime,
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding char *key);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic void set_cache_string(cache *c, char *res, int mode, time_t mtime,
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding char *key, char *value);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic cacheentry *retrieve_cache_string(cache *c, char *res, char *key);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic void store_cache_string(cache *c, char *res, cacheentry *ce);
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding /* misc functions */
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic char *subst_prefix_path(request_rec *r, char *input, char *match,
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding char *subst);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic int parseargline(char *str, char **a1, char **a2, char **a3);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic int prefix_stat(const char *path, struct stat *sb);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic void add_env_variable(request_rec *r, char *s);
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding /* File locking */
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic void fd_lock(request_rec *r, int fd);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic void fd_unlock(request_rec *r, int fd);
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding /* Lexicographic Comparison */
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic int compare_lexicography(char *cpNum1, char *cpNum2);
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#endif /* _MOD_REWRITE_H */
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding/*EOF*/