request.c revision 83a8dc5a596a8a1b9d14f063268287d123b9ed7e
6ae232055d4d8a97267517c5e50074c2c819941and/* ====================================================================
6ae232055d4d8a97267517c5e50074c2c819941and * The Apache Software License, Version 1.1
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd * Copyright (c) 2000-2001 The Apache Software Foundation. All rights
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd * reserved.
6ae232055d4d8a97267517c5e50074c2c819941and * Redistribution and use in source and binary forms, with or without
6ae232055d4d8a97267517c5e50074c2c819941and * modification, are permitted provided that the following conditions
6ae232055d4d8a97267517c5e50074c2c819941and * are met:
6ae232055d4d8a97267517c5e50074c2c819941and * 1. Redistributions of source code must retain the above copyright
6ae232055d4d8a97267517c5e50074c2c819941and * notice, this list of conditions and the following disclaimer.
2e545ce2450a9953665f701bb05350f0d3f26275nd * 2. Redistributions in binary form must reproduce the above copyright
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen * notice, this list of conditions and the following disclaimer in
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen * the documentation and/or other materials provided with the
6ae232055d4d8a97267517c5e50074c2c819941and * distribution.
af33a4994ae2ff15bc67d19ff1a7feb906745bf8rbowen * 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,
b43f840409794ed298e8634f6284741f193b6c4ftakashi * if and wherever such third-party acknowledgments normally appear.
b43f840409794ed298e8634f6284741f193b6c4ftakashi * 4. The names "Apache" and "Apache Software Foundation" must
6ae232055d4d8a97267517c5e50074c2c819941and * not be used to endorse or promote products derived from this
6ae232055d4d8a97267517c5e50074c2c819941and * software without prior written permission. For written
6ae232055d4d8a97267517c5e50074c2c819941and * permission, please contact apache@apache.org.
d474d8ef01ec5c2a09341cd148851ed383c3287crbowen * 5. Products derived from this software may not be called "Apache",
d474d8ef01ec5c2a09341cd148851ed383c3287crbowen * nor may "Apache" appear in their name, without prior written
6ae232055d4d8a97267517c5e50074c2c819941and * permission of the Apache Software Foundation.
b43f840409794ed298e8634f6284741f193b6c4ftakashi * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
b43f840409794ed298e8634f6284741f193b6c4ftakashi * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
b43f840409794ed298e8634f6284741f193b6c4ftakashi * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
6ae232055d4d8a97267517c5e50074c2c819941and * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
6ae232055d4d8a97267517c5e50074c2c819941and * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
6ae232055d4d8a97267517c5e50074c2c819941and * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
6ae232055d4d8a97267517c5e50074c2c819941and * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
6ae232055d4d8a97267517c5e50074c2c819941and * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
6ae232055d4d8a97267517c5e50074c2c819941and * 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 * http_request.c: functions to get and process requests
6ae232055d4d8a97267517c5e50074c2c819941and * Rob McCool 3/21/93
6ae232055d4d8a97267517c5e50074c2c819941and * Thoroughly revamped by rst for Apache. NB this file reads
6ae232055d4d8a97267517c5e50074c2c819941and * best from the bottom up.
6ae232055d4d8a97267517c5e50074c2c819941andAP_IMPLEMENT_HOOK_VOID(insert_filter, (request_rec *r), (r))
return HTTP_INTERNAL_SERVER_ERROR;
return status;
int access_status;
if (access_status) {
return access_status;
return access_status;
return access_status;
return OK;
return access_status;
return access_status;
return access_status;
switch (ap_satisfies(r)) {
case SATISFY_ALL:
case SATISFY_NOSPEC:
if (ap_some_auth_required(r)) {
case SATISFY_ANY:
if (!ap_some_auth_required(r)) {
* in mod-proxy for r->proxyreq && r->parsed_uri.scheme
* && !strcmp(r->parsed_uri.scheme, "http")
return access_status;
return access_status;
return OK;
return OK;
r->filename);
return HTTP_FORBIDDEN;
int res;
return HTTP_FORBIDDEN;
return HTTP_FORBIDDEN;
return OK;
!= APR_SUCCESS)
return HTTP_FORBIDDEN;
return HTTP_FORBIDDEN;
return HTTP_FORBIDDEN;
return OK;
#ifndef REPLACE_PATH_INFO_METHOD
#if defined(OS2)
return OK;
char *lastp;
int res;
return OK;
if (lastp == d)
if (lastp)
return OK;
return HTTP_FORBIDDEN;
return HTTP_FORBIDDEN;
return HTTP_FORBIDDEN;
char *cp;
int rv;
return OK;
#ifdef HAVE_DRIVE_LETTERS
bStripSlash = 0;
#ifdef HAVE_UNC_PATHS
int iCount=0;
p = path;
iCount++;
bStripSlash = 0;
if (bStripSlash)
return OK;
--cp;
return HTTP_FORBIDDEN;
return OK;
&core_module);
char *test_filename;
char *test_dirname;
int res;
unsigned i, num_dirs;
int j, test_filename_len;
return HTTP_INTERNAL_SERVER_ERROR;
return res;
#ifdef NO_LONGER_PARANOID
return HTTP_FORBIDDEN;
r->filename);
return HTTP_FORBIDDEN;
return res;
--num_dirs;
++num_dirs;
#if defined(HAVE_UNC_PATHS)
#if defined(NETWARE)
int overrides_here;
&core_module);
return res;
* from access.conf.
for (; j < num_sec; ++j) {
char *entry_dir;
if (this_conf) {
&core_module);
if (res)
return res;
if (htaccess_conf) {
for (; j < num_sec; ++j) {
if (!entry_core->r) {
* APR_DIR test. But if you accessed /symlink/index.html, for example,
return res;
&core_module);
int sec_idx;
int res;
char *seg_name;
char *delim;
return HTTP_INTERNAL_SERVER_ERROR;
== APR_SUCCESS) {
char *buf;
return HTTP_INTERNAL_SERVER_ERROR;
sec_idx = 0;
int overrides_here;
&core_module);
const char *entry_dir;
&core_module);
if (overrides_here) {
if (res)
return res;
if (htaccess_conf) {
if (delim) {
++seg_name;
if (!*seg_name)
return res;
r->filename);
++seg;
if (!entry_core->r) {
x * APR_DIR test. But if you accessed /symlink/index.html, for example,
&core_module);
char *test_location;
char *entry_uri;
if (!num_loc) {
return OK;
/* Location and LocationMatch differ on their behaviour w.r.t. multiple
for (j = 0; j < num_loc; ++j) {
if (entry_core->r
if (per_uri_defaults)
r->pool);
return OK;
r->pool);
if (per_uri_defaults)
r->per_dir_config,
return OK;
&core_module);
char *test_file;
++test_file;
if (num_files) {
char *entry_file;
for (j = 0; j < num_files; ++j) {
if (entry_core->r) {
if (this_conf)
return OK;
return rr;
if (next_filter) {
if (APR_BUCKET_IS_EOS(e)) {
if (!reqs_arr)
const char *new_file,
const request_rec *r,
int res;
char *udir;
return rnew;
const request_rec *r,
const request_rec *r,
int res;
char *fdir;
char *udir;
return rnew;
return rnew;
return rnew;
return rnew;
const request_rec *r,
int res;
char *fdir;
return rnew;
return rnew;
return rnew;
return rnew;
r->filename);
if (!res) {
return rnew;
int retval;
return retval;