http_request.h revision 0fbbb7938680ecde631ae30271f43a6f6240aa8c
08cb74ca432a8c24e39f17dedce527e6a47b8001jerenkrantz/* ====================================================================
08cb74ca432a8c24e39f17dedce527e6a47b8001jerenkrantz * The Apache Software License, Version 1.1
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz *
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * Copyright (c) 2000-2002 The Apache Software Foundation. All rights
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * reserved.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz *
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * Redistribution and use in source and binary forms, with or without
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * modification, are permitted provided that the following conditions
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * are met:
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz *
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * 1. Redistributions of source code must retain the above copyright
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * notice, this list of conditions and the following disclaimer.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz *
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * 2. Redistributions in binary form must reproduce the above copyright
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * notice, this list of conditions and the following disclaimer in
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * the documentation and/or other materials provided with the
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * distribution.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz *
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * 3. The end-user documentation included with the redistribution,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * if any, must include the following acknowledgment:
2d728410bcf9e6e53698bb035f516e18efd76d8bnd * "This product includes software developed by the
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * Apache Software Foundation (http://www.apache.org/)."
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * Alternately, this acknowledgment may appear in the software itself,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * if and wherever such third-party acknowledgments normally appear.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz *
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * 4. The names "Apache" and "Apache Software Foundation" must
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * not be used to endorse or promote products derived from this
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * software without prior written permission. For written
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * permission, please contact apache@apache.org.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz *
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * 5. Products derived from this software may not be called "Apache",
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * nor may "Apache" appear in their name, without prior written
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * permission of the Apache Software Foundation.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz *
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
355fe82568cec1386bfddc86b1cdf4df0c783a05asteinmetz * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * SUCH DAMAGE.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * ====================================================================
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz *
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * This software consists of voluntary contributions made by many
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * individuals on behalf of the Apache Software Foundation. For more
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * information on the Apache Software Foundation, please see
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * <http://www.apache.org/>.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz *
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * Portions of this software are based upon public domain software
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * originally written at the National Center for Supercomputing Applications,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * University of Illinois, Urbana-Champaign.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz#ifndef APACHE_HTTP_REQUEST_H
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz#define APACHE_HTTP_REQUEST_H
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz#include "apr_hooks.h"
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz#include "util_filter.h"
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz#ifdef __cplusplus
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzextern "C" {
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz#endif
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd#define AP_SUBREQ_NO_ARGS 0
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz#define AP_SUBREQ_MERGE_ARGS 1
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd/**
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * @file http_request.h
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * @brief Apache Request library
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd */
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz/* http_request.c is the code which handles the main line of request
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * processing, once a request has been read in (finding the right per-
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * directory configuration, building it if necessary, and calling all
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * the module dispatch functions in the right order).
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd *
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * The pieces here which are public to the modules, allow them to learn
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * how the server would handle some other file or URI, or perhaps even
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * direct the server to serve that other file instead of the one the
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * client requested directly.
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd *
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * There are two ways to do that. The first is the sub_request mechanism,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * which handles looking up files and URIs as adjuncts to some other
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * request (e.g., directory entries for multiviews and directory listings);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * the lookup functions stop short of actually running the request, but
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * (e.g., for includes), a module may call for the request to be run
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * by calling run_sub_req. The space allocated to create sub_reqs can be
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * reclaimed by calling destroy_sub_req --- be sure to copy anything you care
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * about which was allocated in its apr_pool_t elsewhere before doing this.
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd */
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd/**
663c339c8a4663cf1977f890481f8b7e251d3221jerenkrantz * An internal handler used by the ap_process_request, all sub request mechanisms
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * and the redirect mechanism.
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * @param r The request, subrequest or internal redirect to pre-process
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * @return The return code for the request
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd */
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9ndAP_DECLARE(int) ap_process_request_internal(request_rec *r);
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd/**
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * Create a sub request from the given URI. This sub request can be
2d728410bcf9e6e53698bb035f516e18efd76d8bnd * inspected to find information about the requested URI
2d728410bcf9e6e53698bb035f516e18efd76d8bnd * @param new_file The URI to lookup
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * @param r The current request
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * @param next_filter The first filter the sub_request should use. If this is
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * NULL, it defaults to the first filter for the main request
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * @return The new request record
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * @deffunc request_rec * ap_sub_req_lookup_uri(const char *new_file, const request_rec *r)
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzAP_DECLARE(request_rec *) ap_sub_req_lookup_uri(const char *new_file,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz const request_rec *r,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz ap_filter_t *next_filter);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz/**
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * Create a sub request for the given file. This sub request can be
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * inspected to find information about the requested file
a51acf58d9d82f52e0ee56106cd9282030f3f3bend * @param new_file The URI to lookup
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * @param r The current request
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * @param next_filter The first filter the sub_request should use. If this is
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * NULL, it defaults to the first filter for the main request
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * @return The new request record
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * @deffunc request_rec * ap_sub_req_lookup_file(const char *new_file, const request_rec *r)
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzAP_DECLARE(request_rec *) ap_sub_req_lookup_file(const char *new_file,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz const request_rec *r,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz ap_filter_t *next_filter);
a51acf58d9d82f52e0ee56106cd9282030f3f3bend/**
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * Create a sub request for the given apr_dir_read result. This sub request
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * can be inspected to find information about the requested file
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * @param finfo The apr_dir_read result to lookup
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * @param r The current request
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * @param subtype What type of subrequest to perform, one of;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * <PRE>
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * AP_SUBREQ_NO_ARGS ignore r->args and r->path_info
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * AP_SUBREQ_MERGE_ARGS merge r->args and r->path_info
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * </PRE>
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * @param next_filter The first filter the sub_request should use. If this is
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * NULL, it defaults to the first filter for the main request
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * @return The new request record
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * @deffunc request_rec * ap_sub_req_lookup_dirent(apr_finfo_t *finfo, int subtype, const request_rec *r)
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * @tip The apr_dir_read flags value APR_FINFO_MIN|APR_FINFO_NAME flag is the
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * minimum recommended query if the results will be passed to apr_dir_read.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * The file info passed must include the name, and must have the same relative
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * directory as the current request.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzAP_DECLARE(request_rec *) ap_sub_req_lookup_dirent(const apr_finfo_t *finfo,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz const request_rec *r,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz int subtype,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz ap_filter_t *next_filter);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz/**
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * Create a sub request for the given URI using a specific method. This
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * sub request can be inspected to find information about the requested URI
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * @param method The method to use in the new sub request
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * @param new_file The URI to lookup
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * @param r The current request
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * @param next_filter The first filter the sub_request should use. If this is
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * NULL, it defaults to the first filter for the main request
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * @return The new request record
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * @deffunc request_rec * ap_sub_req_method_uri(const char *method, const char *new_file, const request_rec *r)
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzAP_DECLARE(request_rec *) ap_sub_req_method_uri(const char *method,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz const char *new_file,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz const request_rec *r,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz ap_filter_t *next_filter);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz/**
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * An output filter to strip EOS buckets from sub-requests. This always
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * has to be inserted at the end of a sub-requests filter stack.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * @param f The current filter
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * @param bb The brigade to filter
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * @deffunc apr_status_t ap_sub_req_output_filter(ap_filter_t *f, apr_bucket_brigade *bb)
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzAP_CORE_DECLARE_NONSTD(apr_status_t) ap_sub_req_output_filter(ap_filter_t *f,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz apr_bucket_brigade *bb);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz/**
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * Run the handler for the sub request
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * @param r The sub request to run
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * @return The return code for the sub request
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * @deffunc int ap_run_sub_req(request_rec *r)
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzAP_DECLARE(int) ap_run_sub_req(request_rec *r);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz/**
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * Free the memory associated with a sub request
a51acf58d9d82f52e0ee56106cd9282030f3f3bend * @param r The sub request to finish
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * @deffunc void ap_destroy_sub_req(request_rec *r)
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzAP_DECLARE(void) ap_destroy_sub_req(request_rec *r);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz/*
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * Then there's the case that you want some other request to be served
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * as the top-level request INSTEAD of what the client requested directly.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * If so, call this from a handler, and then immediately return OK.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz/**
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * Redirect the current request to some other uri
a51acf58d9d82f52e0ee56106cd9282030f3f3bend * @param new_uri The URI to replace the current request with
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * @param r The current request
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * @deffunc void ap_internal_redirect(const char *new_uri, request_rec *r)
a51acf58d9d82f52e0ee56106cd9282030f3f3bend */
a51acf58d9d82f52e0ee56106cd9282030f3f3bendAP_DECLARE(void) ap_internal_redirect(const char *new_uri, request_rec *r);
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
a51acf58d9d82f52e0ee56106cd9282030f3f3bend/**
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * This function is designed for things like actions or CGI scripts, when
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * using AddHandler, and you want to preserve the content type across
a51acf58d9d82f52e0ee56106cd9282030f3f3bend * an internal redirect.
a51acf58d9d82f52e0ee56106cd9282030f3f3bend * @param new_uri The URI to replace the current request with.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * @param r The current request
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * @deffunc void ap_internal_redirect_handler(const char *new_uri, request_rec *r)
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzAP_DECLARE(void) ap_internal_redirect_handler(const char *new_uri, request_rec *r);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz/**
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * Redirect the current request to a sub_req, merging the pools
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * @param sub_req A subrequest created from this request
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * @param r The current request
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * @deffunc void ap_internal_fast_redirect(request_rec *sub_req, request_rec *r)
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * @tip the sub_req's pool will be merged into r's pool, be very careful
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * not to destroy this subrequest, it will be destroyed with the main request!
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzAP_DECLARE(void) ap_internal_fast_redirect(request_rec *sub_req, request_rec *r);
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd/**
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * Can be used within any handler to determine if any authentication
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * is required for the current request
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * @param r The current request
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * @return 1 if authentication is required, 0 otherwise
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * @deffunc int ap_some_auth_required(request_rec *r)
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd */
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9ndAP_DECLARE(int) ap_some_auth_required(request_rec *r);
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd/**
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * Determine if the current request is the main request or a sub requests
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * @param r The current request
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * @retrn 1 if this is a main request, 0 otherwise
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * @deffunc int ap_is_initial_req(request_rec *r)
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzAP_DECLARE(int) ap_is_initial_req(request_rec *r);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz/**
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * Function to set the r->mtime field to the specified value if it's later
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * than what's already there.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * @param r The current request
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * @param dependency_time Time to set the mtime to
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * @deffunc void ap_update_mtime(request_rec *r, apr_time_t dependency_mtime)
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzAP_DECLARE(void) ap_update_mtime(request_rec *r, apr_time_t dependency_mtime);
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd/**
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * Add one or more methods to the list permitted to access the resource.
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * Usually executed by the content handler before the response header is
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * sent, but sometimes invoked at an earlier phase if a module knows it
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * can set the list authoritatively. Note that the methods are ADDED
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * to any already permitted unless the reset flag is non-zero. The
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * list is used to generate the Allow response header field when it
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * is needed.
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * @param r The pointer to the request identifying the resource.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * @param reset Boolean flag indicating whether this list should
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * completely replace any current settings.
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * @param ... A NULL-terminated list of strings, each identifying a
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * method name to add.
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * @return None.
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * @deffunc void ap_allow_methods(request_rec *r, int reset, ...)
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd */
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9ndAP_DECLARE(void) ap_allow_methods(request_rec *r, int reset, ...);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz/**
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * Add one or more methods to the list permitted to access the resource.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * Usually executed by the content handler before the response header is
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * sent, but sometimes invoked at an earlier phase if a module knows it
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * can set the list authoritatively. Note that the methods are ADDED
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * to any already permitted unless the reset flag is non-zero. The
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * list is used to generate the Allow response header field when it
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * is needed.
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * @param r The pointer to the request identifying the resource.
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * @param reset Boolean flag indicating whether this list should
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * completely replace any current settings.
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * @param ... A list of method identifiers, from the "M_" series
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * defined in httpd.h, terminated with a value of -1
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * (e.g., "M_GET, M_POST, M_OPTIONS, -1")
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * @return None.
663c339c8a4663cf1977f890481f8b7e251d3221jerenkrantz * @deffunc void ap_allow_standard_methods(request_rec *r, int reset, ...)
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd */
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9ndAP_DECLARE(void) ap_allow_standard_methods(request_rec *r, int reset, ...);
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd#define MERGE_ALLOW 0
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd#define REPLACE_ALLOW 1
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd#ifdef CORE_PRIVATE
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd/* Function called by main.c to handle first-level request */
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9ndvoid ap_process_request(request_rec *);
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd/**
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * Kill the current request
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * @param type Why the request is dieing
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * @param r The current request
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * @deffunc void ap_die(int type, request_rec *r)
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd */
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9ndAP_DECLARE(void) ap_die(int type, request_rec *r);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz#endif
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
0ecc05d02d9ee3d110cb9e263080aaa2b77a12f9jim/* Hooks */
07d000c26f08bb7d590da25057748b28b8b59741jim
07d000c26f08bb7d590da25057748b28b8b59741jim/**
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * Gives modules a chance to create their request_config entry when the
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * request is created.
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * @param r The current request
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * @ingroup hooks
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz */
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9ndAP_DECLARE_HOOK(int,create_request,(request_rec *r))
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd/**
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * This hook allow modules an opportunity to translate the URI into an
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * actual filename. If no modules do anything special, the server's default
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * rules will be followed.
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * @param r The current request
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * @return OK, DECLINED, or HTTP_...
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * @ingroup hooks
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzAP_DECLARE_HOOK(int,translate_name,(request_rec *r))
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd/**
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * This hook allow modules to set the per_dir_config based on their own
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * context (such as <Proxy > sections) and responds to contextless requests
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * such as TRACE that need no security or filesystem mapping.
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * based on the filesystem.
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * @param r The current request
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * @return DONE (or HTTP_) if this contextless request was just fulfilled
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * (such as TRACE), OK if this is not a file, and DECLINED if this is a file.
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * The core map_to_storage (HOOK_RUN_LAST) will directory_walk and file_walk
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * the r->filename.
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd *
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * @ingroup hooks
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd */
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9ndAP_DECLARE_HOOK(int,map_to_storage,(request_rec *r))
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd/**
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * This hook allows modules to check the authentication information sent with
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * the request.
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * @param r The current request
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * @return OK, DECLINED, or HTTP_...
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * @ingroup hooks
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd */
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9ndAP_DECLARE_HOOK(int,check_user_id,(request_rec *r))
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd/**
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * Allows modules to perform module-specific fixing of header fields. This
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * is invoked just before any content-handler
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * @param r The current request
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * @return OK, DECLINED, or HTTP_...
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * @ingroup hooks
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd */
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9ndAP_DECLARE_HOOK(int,fixups,(request_rec *r))
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd/**
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * This routine is called to determine and/or set the various document type
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * information bits, like Content-type (via r->content_type), language, et
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * cetera.
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * @param r the current request
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * @return OK, DECLINED, or HTTP_...
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * @ingroup hooks
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd */
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9ndAP_DECLARE_HOOK(int,type_checker,(request_rec *r))
663c339c8a4663cf1977f890481f8b7e251d3221jerenkrantz
663c339c8a4663cf1977f890481f8b7e251d3221jerenkrantz/**
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * This routine is called to check for any module-specific restrictions placed
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * upon the requested resource.
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * @param r the current request
663c339c8a4663cf1977f890481f8b7e251d3221jerenkrantz * @return OK, DECLINED, or HTTP_...
663c339c8a4663cf1977f890481f8b7e251d3221jerenkrantz * @ingroup hooks
663c339c8a4663cf1977f890481f8b7e251d3221jerenkrantz */
663c339c8a4663cf1977f890481f8b7e251d3221jerenkrantzAP_DECLARE_HOOK(int,access_checker,(request_rec *r))
663c339c8a4663cf1977f890481f8b7e251d3221jerenkrantz
663c339c8a4663cf1977f890481f8b7e251d3221jerenkrantz/**
663c339c8a4663cf1977f890481f8b7e251d3221jerenkrantz * This routine is called to check to see if the resource being requested
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * requires authorisation.
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * @param r the current request
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * @return OK, DECLINED, or HTTP_...
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * @ingroup hooks
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd */
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9ndAP_DECLARE_HOOK(int,auth_checker,(request_rec *r))
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd/**
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * This hook allows modules to insert filters for the current request
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * @param r the current request
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * @ingroup hooks
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd */
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9ndAP_DECLARE_HOOK(void,insert_filter,(request_rec *r))
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9ndAP_DECLARE(int) ap_location_walk(request_rec *r);
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9ndAP_DECLARE(int) ap_directory_walk(request_rec *r);
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9ndAP_DECLARE(int) ap_file_walk(request_rec *r);
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd#ifdef __cplusplus
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd}
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd#endif
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd#endif /* !APACHE_HTTP_REQUEST_H */
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd