request.c revision 1fbf6ba0f5207e6637b49f9a9dfcc779bbe952a9
c1d71ac637c449feb0a25369f029397e6a1f241cChristian Maeder/* ====================================================================
adea2e45fa61f1097aadc490a0aeaf4831b729ccChristian Maeder * The Apache Software License, Version 1.1
df11e5eab86d8247f58e301d8f0a2c6ecf4c9541Till Mossakowski * Copyright (c) 2000-2003 The Apache Software Foundation. All rights
b4fbc96e05117839ca409f5f20f97b3ac872d1edTill Mossakowski * Redistribution and use in source and binary forms, with or without
df11e5eab86d8247f58e301d8f0a2c6ecf4c9541Till Mossakowski * modification, are permitted provided that the following conditions
adea2e45fa61f1097aadc490a0aeaf4831b729ccChristian Maeder * 1. Redistributions of source code must retain the above copyright
df11e5eab86d8247f58e301d8f0a2c6ecf4c9541Till Mossakowski * notice, this list of conditions and the following disclaimer.
df11e5eab86d8247f58e301d8f0a2c6ecf4c9541Till Mossakowski * 2. Redistributions in binary form must reproduce the above copyright
df11e5eab86d8247f58e301d8f0a2c6ecf4c9541Till Mossakowski * notice, this list of conditions and the following disclaimer in
df11e5eab86d8247f58e301d8f0a2c6ecf4c9541Till Mossakowski * the documentation and/or other materials provided with the
df11e5eab86d8247f58e301d8f0a2c6ecf4c9541Till Mossakowski * distribution.
df11e5eab86d8247f58e301d8f0a2c6ecf4c9541Till Mossakowski * 3. The end-user documentation included with the redistribution,
df11e5eab86d8247f58e301d8f0a2c6ecf4c9541Till Mossakowski * if any, must include the following acknowledgment:
df11e5eab86d8247f58e301d8f0a2c6ecf4c9541Till Mossakowski * "This product includes software developed by the
df11e5eab86d8247f58e301d8f0a2c6ecf4c9541Till Mossakowski * Apache Software Foundation (http://www.apache.org/)."
df11e5eab86d8247f58e301d8f0a2c6ecf4c9541Till Mossakowski * Alternately, this acknowledgment may appear in the software itself,
df11e5eab86d8247f58e301d8f0a2c6ecf4c9541Till Mossakowski * if and wherever such third-party acknowledgments normally appear.
88ece6e49930670e8fd3ee79c89a2e918d2fbd0cChristian Maeder * 4. The names "Apache" and "Apache Software Foundation" must
df11e5eab86d8247f58e301d8f0a2c6ecf4c9541Till Mossakowski * not be used to endorse or promote products derived from this
adea2e45fa61f1097aadc490a0aeaf4831b729ccChristian Maeder * software without prior written permission. For written
df11e5eab86d8247f58e301d8f0a2c6ecf4c9541Till Mossakowski * permission, please contact apache@apache.org.
df11e5eab86d8247f58e301d8f0a2c6ecf4c9541Till Mossakowski * 5. Products derived from this software may not be called "Apache",
df11e5eab86d8247f58e301d8f0a2c6ecf4c9541Till Mossakowski * nor may "Apache" appear in their name, without prior written
df11e5eab86d8247f58e301d8f0a2c6ecf4c9541Till Mossakowski * permission of the Apache Software Foundation.
adea2e45fa61f1097aadc490a0aeaf4831b729ccChristian Maeder * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
df11e5eab86d8247f58e301d8f0a2c6ecf4c9541Till Mossakowski * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
df11e5eab86d8247f58e301d8f0a2c6ecf4c9541Till Mossakowski * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
df11e5eab86d8247f58e301d8f0a2c6ecf4c9541Till Mossakowski * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
df11e5eab86d8247f58e301d8f0a2c6ecf4c9541Till Mossakowski * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
df11e5eab86d8247f58e301d8f0a2c6ecf4c9541Till Mossakowski * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
df11e5eab86d8247f58e301d8f0a2c6ecf4c9541Till Mossakowski * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
df11e5eab86d8247f58e301d8f0a2c6ecf4c9541Till Mossakowski * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
df11e5eab86d8247f58e301d8f0a2c6ecf4c9541Till Mossakowski * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
df11e5eab86d8247f58e301d8f0a2c6ecf4c9541Till Mossakowski * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
df11e5eab86d8247f58e301d8f0a2c6ecf4c9541Till Mossakowski * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
df11e5eab86d8247f58e301d8f0a2c6ecf4c9541Till Mossakowski * SUCH DAMAGE.
df11e5eab86d8247f58e301d8f0a2c6ecf4c9541Till Mossakowski * ====================================================================
df11e5eab86d8247f58e301d8f0a2c6ecf4c9541Till Mossakowski * This software consists of voluntary contributions made by many
df11e5eab86d8247f58e301d8f0a2c6ecf4c9541Till Mossakowski * individuals on behalf of the Apache Software Foundation. For more
df11e5eab86d8247f58e301d8f0a2c6ecf4c9541Till Mossakowski * information on the Apache Software Foundation, please see
df11e5eab86d8247f58e301d8f0a2c6ecf4c9541Till Mossakowski * Portions of this software are based upon public domain software
df11e5eab86d8247f58e301d8f0a2c6ecf4c9541Till Mossakowski * originally written at the National Center for Supercomputing Applications,
adea2e45fa61f1097aadc490a0aeaf4831b729ccChristian Maeder * University of Illinois, Urbana-Champaign.
df11e5eab86d8247f58e301d8f0a2c6ecf4c9541Till Mossakowski * http_request.c: functions to get and process requests
df11e5eab86d8247f58e301d8f0a2c6ecf4c9541Till Mossakowski * Rob McCool 3/21/93
df11e5eab86d8247f58e301d8f0a2c6ecf4c9541Till Mossakowski * Thoroughly revamped by rst for Apache. NB this file reads
df11e5eab86d8247f58e301d8f0a2c6ecf4c9541Till Mossakowski * best from the bottom up.
df11e5eab86d8247f58e301d8f0a2c6ecf4c9541Till MossakowskiAP_IMPLEMENT_HOOK_RUN_FIRST(int,translate_name,
88ece6e49930670e8fd3ee79c89a2e918d2fbd0cChristian MaederAP_IMPLEMENT_HOOK_RUN_FIRST(int,map_to_storage,
df11e5eab86d8247f58e301d8f0a2c6ecf4c9541Till MossakowskiAP_IMPLEMENT_HOOK_RUN_FIRST(int,check_user_id,
df11e5eab86d8247f58e301d8f0a2c6ecf4c9541Till MossakowskiAP_IMPLEMENT_HOOK_RUN_FIRST(int,type_checker,
df11e5eab86d8247f58e301d8f0a2c6ecf4c9541Till MossakowskiAP_IMPLEMENT_HOOK_RUN_ALL(int,access_checker,
df11e5eab86d8247f58e301d8f0a2c6ecf4c9541Till MossakowskiAP_IMPLEMENT_HOOK_RUN_FIRST(int,auth_checker,
df11e5eab86d8247f58e301d8f0a2c6ecf4c9541Till MossakowskiAP_IMPLEMENT_HOOK_VOID(insert_filter, (request_rec *r), (r))
df11e5eab86d8247f58e301d8f0a2c6ecf4c9541Till MossakowskiAP_IMPLEMENT_HOOK_RUN_ALL(int, create_request,
df11e5eab86d8247f58e301d8f0a2c6ecf4c9541Till Mossakowskistatic int decl_die(int status, char *phase, request_rec *r)
df11e5eab86d8247f58e301d8f0a2c6ecf4c9541Till Mossakowski ap_log_rerror(APLOG_MARK, APLOG_CRIT, 0, r,
df11e5eab86d8247f58e301d8f0a2c6ecf4c9541Till Mossakowski "configuration error: couldn't %s: %s", phase, r->uri);
return status;
int access_status;
core_dir_config *d;
if (d->allow_encoded_slashes) {
if (access_status) {
if (! d->allow_encoded_slashes) {
return access_status;
if (!file_req) {
return access_status;
return access_status;
if (!file_req) {
return access_status;
return access_status;
switch (ap_satisfies(r)) {
case SATISFY_ALL:
case SATISFY_NOSPEC:
if (ap_some_auth_required(r)) {
|| !ap_auth_type(r)) {
|| !ap_auth_type(r)) {
case SATISFY_ANY:
if (!ap_some_auth_required(r)) {
|| !ap_auth_type(r)) {
|| !ap_auth_type(r)) {
* in mod-proxy for r->proxyreq && r->parsed_uri.scheme
* && !strcmp(r->parsed_uri.scheme, "http")
return access_status;
return OK;
* Directive order in the httpd.conf file and its Includes significantly
typedef struct walk_walked_t {
typedef struct walk_cache_t {
} walk_cache_t;
void **note;
if (!note) {
return NULL;
void **inherit_note;
if ((r->main
&& *inherit_note)
|| (r->prev
&& *inherit_note)) {
sizeof(*cache));
return cache;
int res;
const char *savename;
return HTTP_FORBIDDEN;
| APR_FINFO_LINK), p))
!= APR_SUCCESS) {
return HTTP_FORBIDDEN;
if (savename) {
return OK;
!= APR_SUCCESS) {
return HTTP_FORBIDDEN;
!= APR_SUCCESS) {
return HTTP_FORBIDDEN;
return HTTP_FORBIDDEN;
if (savename) {
return OK;
* See core.c::merge_core_dir_configs() for explanation.
typedef struct core_opts_t {
} core_opts_t;
if (!this_dir) {
&core_module);
char *entry_dir;
r->uri);
return OK;
!= APR_SUCCESS) {
return OK;
/* some OSs will return APR_SUCCESS/APR_REG if we stat
* Otherwise (as is the case with most dir_merged/file_merged requests)
return OK;
return OK;
int sec_idx;
char *save_path_info;
char *buf;
#ifdef CASE_BLIND_FILESYSTEM
r->path_info,
!= APR_SUCCESS) {
return HTTP_INTERNAL_SERVER_ERROR;
#ifdef CASE_BLIND_FILESYSTEM
canonical_len = 0;
while (canonical_len
(const char **)&r->path_info,
r->pool);
(const char **)&r->path_info,
canonical_len = 0;
(const char **)&r->path_info,
0, r->pool);
return HTTP_INTERNAL_SERVER_ERROR;
sec_idx = 0;
int res;
char *seg_name;
char *delim;
int temp_slash=0;
if (matches) {
++last_walk;
--matches;
matches = 0;
if (now_merged) {
if (res) {
return res;
if (!htaccess_conf) {
if (matches) {
++last_walk;
--matches;
matches = 0;
if (now_merged) {
if (temp_slash) {
if (delim) {
++seg_name;
if (!*seg_name) {
#ifdef CASE_BLIND_FILESYSTEM
++seg;
r->pool);
r->filename);
r->filename);
++seg;
if (save_path_info) {
if (!entry_core->r) {
if (matches) {
++last_walk;
--matches;
matches = 0;
if (now_merged) {
if (matches) {
x * APR_DIR test. But if you accessed /symlink/index.html, for example,
if (now_merged) {
r->per_dir_config,
return OK;
&core_module);
const char *entry_uri;
if (!num_sec) {
return OK;
/* Location and LocationMatch differ on their behaviour w.r.t. multiple
* Otherwise (as is the case with most dir_merged/file_merged requests)
return OK;
return OK;
if (entry_core->r
if (matches) {
++last_walk;
--matches;
matches = 0;
if (now_merged) {
if (matches) {
if (now_merged) {
r->per_dir_config,
return OK;
&core_module);
const char *test_file;
return OK;
if (!num_sec) {
return OK;
return OK;
return OK;
int sec_idx;
if (entry_core->r
if (matches) {
++last_walk;
--matches;
matches = 0;
if (now_merged) {
if (matches) {
if (now_merged) {
r->per_dir_config,
return OK;
if (next_filter) {
return rnew;
if (APR_BUCKET_IS_EOS(e)) {
return APR_SUCCESS;
if (!reqs_arr) {
const char *new_file,
const request_rec *r,
int res;
char *udir;
if (ap_is_recursion_limit_exceeded(r)) {
return rnew;
return rnew;
const request_rec *r,
const request_rec *r,
int subtype,
int res;
char *fdir;
char *udir;
!= OK) {
return rnew;
if (ap_is_recursion_limit_exceeded(r)) {
return rnew;
return rnew;
const request_rec *r,
int res;
char *fdir;
return rnew;
if (ap_is_recursion_limit_exceeded(r)) {
return rnew;
return rnew;
return retval;