http_request.h revision 842ae4bd224140319ae7feec1872b93dfd491143
842ae4bd224140319ae7feec1872b93dfd491143fielding/* Licensed to the Apache Software Foundation (ASF) under one or more
842ae4bd224140319ae7feec1872b93dfd491143fielding * contributor license agreements. See the NOTICE file distributed with
842ae4bd224140319ae7feec1872b93dfd491143fielding * this work for additional information regarding copyright ownership.
842ae4bd224140319ae7feec1872b93dfd491143fielding * The ASF licenses this file to You under the Apache License, Version 2.0
842ae4bd224140319ae7feec1872b93dfd491143fielding * (the "License"); you may not use this file except in compliance with
842ae4bd224140319ae7feec1872b93dfd491143fielding * the License. You may obtain a copy of the License at
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding *
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd * http://www.apache.org/licenses/LICENSE-2.0
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding *
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd * Unless required by applicable law or agreed to in writing, software
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd * distributed under the License is distributed on an "AS IS" BASIS,
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd * See the License for the specific language governing permissions and
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd * limitations under the License.
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding */
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding/**
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * @file http_request.h
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * @brief Apache Request library
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding *
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * request.c is the code which handles the main line of request
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * processing, once a request has been read in (finding the right per-
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * directory configuration, building it if necessary, and calling all
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * the module dispatch functions in the right order).
dc80439e9fba60c753cd145cb6799409ffea9b71ronald *
dc80439e9fba60c753cd145cb6799409ffea9b71ronald * The pieces here which are public to the modules, allow them to learn
dc80439e9fba60c753cd145cb6799409ffea9b71ronald * how the server would handle some other file or URI, or perhaps even
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * direct the server to serve that other file instead of the one the
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * client requested directly.
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding *
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * There are two ways to do that. The first is the sub_request mechanism,
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * which handles looking up files and URIs as adjuncts to some other
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * request (e.g., directory entries for multiviews and directory listings);
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * the lookup functions stop short of actually running the request, but
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * (e.g., for includes), a module may call for the request to be run
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * by calling run_sub_req. The space allocated to create sub_reqs can be
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * reclaimed by calling destroy_sub_req --- be sure to copy anything you care
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * about which was allocated in its apr_pool_t elsewhere before doing this.
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding */
dc80439e9fba60c753cd145cb6799409ffea9b71ronald
dc80439e9fba60c753cd145cb6799409ffea9b71ronald#ifndef APACHE_HTTP_REQUEST_H
dc80439e9fba60c753cd145cb6799409ffea9b71ronald#define APACHE_HTTP_REQUEST_H
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#include "apr_hooks.h"
dc80439e9fba60c753cd145cb6799409ffea9b71ronald#include "util_filter.h"
dc80439e9fba60c753cd145cb6799409ffea9b71ronald
dc80439e9fba60c753cd145cb6799409ffea9b71ronald#ifdef __cplusplus
dc80439e9fba60c753cd145cb6799409ffea9b71ronaldextern "C" {
dc80439e9fba60c753cd145cb6799409ffea9b71ronald#endif
dc80439e9fba60c753cd145cb6799409ffea9b71ronald
dc80439e9fba60c753cd145cb6799409ffea9b71ronald#define AP_SUBREQ_NO_ARGS 0
dc80439e9fba60c753cd145cb6799409ffea9b71ronald#define AP_SUBREQ_MERGE_ARGS 1
dc80439e9fba60c753cd145cb6799409ffea9b71ronald
e8f95a682820a599fe41b22977010636be5c2717jim/**
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * An internal handler used by the ap_process_request, all subrequest mechanisms
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * and the redirect mechanism.
b980ad7fdc218b4855cde9f75a747527f50c554dwrowe * @param r The request, subrequest or internal redirect to pre-process
b980ad7fdc218b4855cde9f75a747527f50c554dwrowe * @return The return code for the request
694e8dc146faadc46b2455f3bd0998121fc76c5drbb */
c7d0205ec1649076e7742d72a25ac53779768312stoddardAP_DECLARE(int) ap_process_request_internal(request_rec *r);
c7d0205ec1649076e7742d72a25ac53779768312stoddard
29c30db45f6a469017e16b606611e460cc1a1f2caaron/**
032b8a34c3911bbc5ad5385ca40af65af273bff9wrowe * Create a subrequest from the given URI. This subrequest can be
e33b627b40578d0166fdb79ce0487f9e46586befgstein * inspected to find information about the requested URI
cd9f429ff62d134cdf6ec903c33430c5ebae12f0trawick * @param new_uri The URI to lookup
cd9f429ff62d134cdf6ec903c33430c5ebae12f0trawick * @param r The current request
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * @param next_filter The first filter the sub_request should use. If this is
e33b627b40578d0166fdb79ce0487f9e46586befgstein * NULL, it defaults to the first filter for the main request
e33b627b40578d0166fdb79ce0487f9e46586befgstein * @return The new request record
e33b627b40578d0166fdb79ce0487f9e46586befgstein */
e33b627b40578d0166fdb79ce0487f9e46586befgsteinAP_DECLARE(request_rec *) ap_sub_req_lookup_uri(const char *new_uri,
e33b627b40578d0166fdb79ce0487f9e46586befgstein const request_rec *r,
e33b627b40578d0166fdb79ce0487f9e46586befgstein ap_filter_t *next_filter);
e33b627b40578d0166fdb79ce0487f9e46586befgstein
864c5615d55b8ebbde24e72043f6325741335a74fielding/**
e33b627b40578d0166fdb79ce0487f9e46586befgstein * Create a subrequest for the given file. This subrequest can be
26dfa083a1662d57ba7cc410eec4e0696b9be469wrowe * inspected to find information about the requested file
26dfa083a1662d57ba7cc410eec4e0696b9be469wrowe * @param new_file The file to lookup
e9f8410b788ef1e6f1baed6c706ffdf3da395a16jerenkrantz * @param r The current request
e33b627b40578d0166fdb79ce0487f9e46586befgstein * @param next_filter The first filter the sub_request should use. If this is
322b350d0f1ac750b112ec15481a33efc92d182cjerenkrantz * NULL, it defaults to the first filter for the main request
322b350d0f1ac750b112ec15481a33efc92d182cjerenkrantz * @return The new request record
97d20d37d21b8d427a920e211858172f0a82427epoirier */
97d20d37d21b8d427a920e211858172f0a82427epoirierAP_DECLARE(request_rec *) ap_sub_req_lookup_file(const char *new_file,
97d20d37d21b8d427a920e211858172f0a82427epoirier const request_rec *r,
8ec8f1c8f0f37ca3f5ebb0e0b491dd07481dccbfronald ap_filter_t *next_filter);
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding/**
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * Create a subrequest for the given apr_dir_read result. This subrequest
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * can be inspected to find information about the requested file
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * @param finfo The apr_dir_read result to lookup
bdfba727693ab86e9914ca90af68e62896946755jerenkrantz * @param r The current request
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * @param subtype What type of subrequest to perform, one of;
9db34d31d4df0b29d128ecd724cd177905108b0frbb * <PRE>
b980ad7fdc218b4855cde9f75a747527f50c554dwrowe * AP_SUBREQ_NO_ARGS ignore r->args and r->path_info
1ccd992d37d62c8cb2056126f2234f64ec189bfddougm * AP_SUBREQ_MERGE_ARGS merge r->args and r->path_info
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * </PRE>
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * @param next_filter The first filter the sub_request should use. If this is
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * NULL, it defaults to the first filter for the main request
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * @return The new request record
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * @note The apr_dir_read flags value APR_FINFO_MIN|APR_FINFO_NAME flag is the
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * minimum recommended query if the results will be passed to apr_dir_read.
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * The file info passed must include the name, and must have the same relative
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * directory as the current request.
0ec6007a40ac877a7c8d87767ca8e306d89f6595aaron */
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingAP_DECLARE(request_rec *) ap_sub_req_lookup_dirent(const apr_finfo_t *finfo,
e0fe4de2016336428729a620ac0034cd1198ad7awrowe const request_rec *r,
e0fe4de2016336428729a620ac0034cd1198ad7awrowe int subtype,
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding ap_filter_t *next_filter);
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding/**
0ec6007a40ac877a7c8d87767ca8e306d89f6595aaron * Create a subrequest for the given URI using a specific method. This
0ec6007a40ac877a7c8d87767ca8e306d89f6595aaron * subrequest can be inspected to find information about the requested URI
ec486beb201583aafddf7c7ee9009727a3ade0aafielding * @param method The method to use in the new subrequest
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * @param new_uri The URI to lookup
0ec6007a40ac877a7c8d87767ca8e306d89f6595aaron * @param r The current request
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * @param next_filter The first filter the sub_request should use. If this is
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * NULL, it defaults to the first filter for the main request
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * @return The new request record
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding */
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingAP_DECLARE(request_rec *) ap_sub_req_method_uri(const char *method,
0ec6007a40ac877a7c8d87767ca8e306d89f6595aaron const char *new_uri,
0ec6007a40ac877a7c8d87767ca8e306d89f6595aaron const request_rec *r,
0ec6007a40ac877a7c8d87767ca8e306d89f6595aaron ap_filter_t *next_filter);
d0ba3b97557d47323bd055fb4002ed7692f703b9jerenkrantz/**
0ec6007a40ac877a7c8d87767ca8e306d89f6595aaron * An output filter to strip EOS buckets from sub-requests. This always
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * has to be inserted at the end of a sub-requests filter stack.
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * @param f The current filter
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * @param bb The brigade to filter
dc80439e9fba60c753cd145cb6799409ffea9b71ronald * @return status code
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding */
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingAP_CORE_DECLARE_NONSTD(apr_status_t) ap_sub_req_output_filter(ap_filter_t *f,
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding apr_bucket_brigade *bb);
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding/**
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * Run the handler for the subrequest
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * @param r The subrequest to run
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * @return The return code for the subrequest
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding */
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingAP_DECLARE(int) ap_run_sub_req(request_rec *r);
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding/**
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * Free the memory associated with a subrequest
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * @param r The subrequest to finish
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding */
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingAP_DECLARE(void) ap_destroy_sub_req(request_rec *r);
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding/*
7ddfd45e4d3d13de264931df8eb27ee7619fdb0ejerenkrantz * Then there's the case that you want some other request to be served
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * as the top-level request INSTEAD of what the client requested directly.
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * If so, call this from a handler, and then immediately return OK.
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding */
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding/**
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * Redirect the current request to some other uri
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * @param new_uri The URI to replace the current request with
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * @param r The current request
0ec6007a40ac877a7c8d87767ca8e306d89f6595aaron */
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingAP_DECLARE(void) ap_internal_redirect(const char *new_uri, request_rec *r);
dc80439e9fba60c753cd145cb6799409ffea9b71ronald
0ec6007a40ac877a7c8d87767ca8e306d89f6595aaron/**
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * This function is designed for things like actions or CGI scripts, when
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * using AddHandler, and you want to preserve the content type across
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * an internal redirect.
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * @param new_uri The URI to replace the current request with.
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * @param r The current request
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding */
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingAP_DECLARE(void) ap_internal_redirect_handler(const char *new_uri, request_rec *r);
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0ec6007a40ac877a7c8d87767ca8e306d89f6595aaron/**
1ccd992d37d62c8cb2056126f2234f64ec189bfddougm * Redirect the current request to a sub_req, merging the pools
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * @param sub_req A subrequest created from this request
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * @param r The current request
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * @note the sub_req's pool will be merged into r's pool, be very careful
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * not to destroy this subrequest, it will be destroyed with the main request!
dc80439e9fba60c753cd145cb6799409ffea9b71ronald */
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingAP_DECLARE(void) ap_internal_fast_redirect(request_rec *sub_req, request_rec *r);
26dfa083a1662d57ba7cc410eec4e0696b9be469wrowe
26dfa083a1662d57ba7cc410eec4e0696b9be469wrowe/**
26dfa083a1662d57ba7cc410eec4e0696b9be469wrowe * Can be used within any handler to determine if any authentication
0ec6007a40ac877a7c8d87767ca8e306d89f6595aaron * is required for the current request
29c30db45f6a469017e16b606611e460cc1a1f2caaron * @param r The current request
29c30db45f6a469017e16b606611e460cc1a1f2caaron * @return 1 if authentication is required, 0 otherwise
97d20d37d21b8d427a920e211858172f0a82427epoirier */
97d20d37d21b8d427a920e211858172f0a82427epoirierAP_DECLARE(int) ap_some_auth_required(request_rec *r);
97d20d37d21b8d427a920e211858172f0a82427epoirier
dc80439e9fba60c753cd145cb6799409ffea9b71ronald/**
0ec6007a40ac877a7c8d87767ca8e306d89f6595aaron * Determine if the current request is the main request or a subrequest
0ec6007a40ac877a7c8d87767ca8e306d89f6595aaron * @param r The current request
0ec6007a40ac877a7c8d87767ca8e306d89f6595aaron * @return 1 if this is the main request, 0 otherwise
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding */
dc80439e9fba60c753cd145cb6799409ffea9b71ronaldAP_DECLARE(int) ap_is_initial_req(request_rec *r);
dc80439e9fba60c753cd145cb6799409ffea9b71ronald
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding/**
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * Function to set the r->mtime field to the specified value if it's later
138c8f7cb8254e035c6f45288e3909cd9c21be5cmartin * than what's already there.
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * @param r The current request
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * @param dependency_mtime Time to set the mtime to
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding */
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingAP_DECLARE(void) ap_update_mtime(request_rec *r, apr_time_t dependency_mtime);
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
1ccd992d37d62c8cb2056126f2234f64ec189bfddougm/**
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * Add one or more methods to the list permitted to access the resource.
e8f95a682820a599fe41b22977010636be5c2717jim * Usually executed by the content handler before the response header is
0ec6007a40ac877a7c8d87767ca8e306d89f6595aaron * sent, but sometimes invoked at an earlier phase if a module knows it
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * can set the list authoritatively. Note that the methods are ADDED
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * to any already permitted unless the reset flag is non-zero. The
97d20d37d21b8d427a920e211858172f0a82427epoirier * list is used to generate the Allow response header field when it
97d20d37d21b8d427a920e211858172f0a82427epoirier * is needed.
97d20d37d21b8d427a920e211858172f0a82427epoirier * @param r The pointer to the request identifying the resource.
97d20d37d21b8d427a920e211858172f0a82427epoirier * @param reset Boolean flag indicating whether this list should
97d20d37d21b8d427a920e211858172f0a82427epoirier * completely replace any current settings.
dc80439e9fba60c753cd145cb6799409ffea9b71ronald * @param ... A NULL-terminated list of strings, each identifying a
0ec6007a40ac877a7c8d87767ca8e306d89f6595aaron * method name to add.
0ec6007a40ac877a7c8d87767ca8e306d89f6595aaron * @return None.
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding */
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingAP_DECLARE(void) ap_allow_methods(request_rec *r, int reset, ...);
dc80439e9fba60c753cd145cb6799409ffea9b71ronald
29c30db45f6a469017e16b606611e460cc1a1f2caaron/**
0ec6007a40ac877a7c8d87767ca8e306d89f6595aaron * Add one or more methods to the list permitted to access the resource.
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * Usually executed by the content handler before the response header is
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * sent, but sometimes invoked at an earlier phase if a module knows it
dc80439e9fba60c753cd145cb6799409ffea9b71ronald * can set the list authoritatively. Note that the methods are ADDED
29c30db45f6a469017e16b606611e460cc1a1f2caaron * to any already permitted unless the reset flag is non-zero. The
0ec6007a40ac877a7c8d87767ca8e306d89f6595aaron * list is used to generate the Allow response header field when it
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * is needed.
d0a225bdac006f3361e80bfc1be7e6f9b0e81f80ronald * @param r The pointer to the request identifying the resource.
d0a225bdac006f3361e80bfc1be7e6f9b0e81f80ronald * @param reset Boolean flag indicating whether this list should
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * completely replace any current settings.
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * @param ... A list of method identifiers, from the "M_" series
e1753aabf5df187b5b04e72a958af4b65b1a125daaron * defined in httpd.h, terminated with a value of -1
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * (e.g., "M_GET, M_POST, M_OPTIONS, -1")
1ccd992d37d62c8cb2056126f2234f64ec189bfddougm * @return None.
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding */
12901074f5d6b36d08be84d8637b6f2c21e0da26trawickAP_DECLARE(void) ap_allow_standard_methods(request_rec *r, int reset, ...);
0ec6007a40ac877a7c8d87767ca8e306d89f6595aaron
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define MERGE_ALLOW 0
afd0a335375c636605c8625b0d5755dd2408be2btrawick#define REPLACE_ALLOW 1
1ccd992d37d62c8cb2056126f2234f64ec189bfddougm
afd0a335375c636605c8625b0d5755dd2408be2btrawick#ifdef CORE_PRIVATE
afd0a335375c636605c8625b0d5755dd2408be2btrawick/**
afd0a335375c636605c8625b0d5755dd2408be2btrawick * Process a top-level request from a client, and synchronously write
c7d0205ec1649076e7742d72a25ac53779768312stoddard * the response to the client
e1753aabf5df187b5b04e72a958af4b65b1a125daaron * @param r The current request
e4c4fcc82268e0192db234c74a6db784b879fffdrbb */
9d75c00eea5e840de5ab662f1163014932d9ee78wrowevoid ap_process_request(request_rec *);
e8f95a682820a599fe41b22977010636be5c2717jim
0ec6007a40ac877a7c8d87767ca8e306d89f6595aaron/**
e1753aabf5df187b5b04e72a958af4b65b1a125daaron * Process a top-level request from a client, allowing some or all of
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * the response to remain buffered in the core output filter for later,
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * asynchronous write completion
12901074f5d6b36d08be84d8637b6f2c21e0da26trawick * @param r The current request
e1753aabf5df187b5b04e72a958af4b65b1a125daaron */
e1753aabf5df187b5b04e72a958af4b65b1a125daaronvoid ap_process_async_request(request_rec *);
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding/**
1ccd992d37d62c8cb2056126f2234f64ec189bfddougm * Kill the current request
dc80439e9fba60c753cd145cb6799409ffea9b71ronald * @param type Why the request is dieing
dc80439e9fba60c753cd145cb6799409ffea9b71ronald * @param r The current request
0ec6007a40ac877a7c8d87767ca8e306d89f6595aaron */
0ec6007a40ac877a7c8d87767ca8e306d89f6595aaronAP_DECLARE(void) ap_die(int type, request_rec *r);
dc80439e9fba60c753cd145cb6799409ffea9b71ronald#endif
dc80439e9fba60c753cd145cb6799409ffea9b71ronald
dc80439e9fba60c753cd145cb6799409ffea9b71ronald/* Hooks */
dc80439e9fba60c753cd145cb6799409ffea9b71ronald
a6b9ed64fdf548c61de9714e2cfb999ec59d149cgstein/**
a6b9ed64fdf548c61de9714e2cfb999ec59d149cgstein * Gives modules a chance to create their request_config entry when the
97d20d37d21b8d427a920e211858172f0a82427epoirier * request is created.
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * @param r The current request
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * @ingroup hooks
1ccd992d37d62c8cb2056126f2234f64ec189bfddougm */
97d20d37d21b8d427a920e211858172f0a82427epoirierAP_DECLARE_HOOK(int,create_request,(request_rec *r))
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding/**
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * This hook allow modules an opportunity to translate the URI into an
97d20d37d21b8d427a920e211858172f0a82427epoirier * actual filename. If no modules do anything special, the server's default
97d20d37d21b8d427a920e211858172f0a82427epoirier * rules will be followed.
97d20d37d21b8d427a920e211858172f0a82427epoirier * @param r The current request
97d20d37d21b8d427a920e211858172f0a82427epoirier * @return OK, DECLINED, or HTTP_...
97d20d37d21b8d427a920e211858172f0a82427epoirier * @ingroup hooks
97d20d37d21b8d427a920e211858172f0a82427epoirier */
97d20d37d21b8d427a920e211858172f0a82427epoirierAP_DECLARE_HOOK(int,translate_name,(request_rec *r))
97d20d37d21b8d427a920e211858172f0a82427epoirier
97d20d37d21b8d427a920e211858172f0a82427epoirier/**
97d20d37d21b8d427a920e211858172f0a82427epoirier * This hook allow modules to set the per_dir_config based on their own
97d20d37d21b8d427a920e211858172f0a82427epoirier * context (such as "<Proxy>" sections) and responds to contextless requests
97d20d37d21b8d427a920e211858172f0a82427epoirier * such as TRACE that need no security or filesystem mapping.
97d20d37d21b8d427a920e211858172f0a82427epoirier * based on the filesystem.
97d20d37d21b8d427a920e211858172f0a82427epoirier * @param r The current request
97d20d37d21b8d427a920e211858172f0a82427epoirier * @return DONE (or HTTP_) if this contextless request was just fulfilled
97d20d37d21b8d427a920e211858172f0a82427epoirier * (such as TRACE), OK if this is not a file, and DECLINED if this is a file.
97d20d37d21b8d427a920e211858172f0a82427epoirier * The core map_to_storage (HOOK_RUN_REALLY_LAST) will directory_walk
97d20d37d21b8d427a920e211858172f0a82427epoirier * and file_walk the r->filename.
97d20d37d21b8d427a920e211858172f0a82427epoirier *
97d20d37d21b8d427a920e211858172f0a82427epoirier * @ingroup hooks
97d20d37d21b8d427a920e211858172f0a82427epoirier */
97d20d37d21b8d427a920e211858172f0a82427epoirierAP_DECLARE_HOOK(int,map_to_storage,(request_rec *r))
97d20d37d21b8d427a920e211858172f0a82427epoirier
97d20d37d21b8d427a920e211858172f0a82427epoirier/**
97d20d37d21b8d427a920e211858172f0a82427epoirier * This hook is used to analyze the request headers, authenticate the user,
97d20d37d21b8d427a920e211858172f0a82427epoirier * and set the user information in the request record (r->user and
97d20d37d21b8d427a920e211858172f0a82427epoirier * r->ap_auth_type). This hook is only run when Apache determines that
97d20d37d21b8d427a920e211858172f0a82427epoirier * authentication/authorization is required for this resource (as determined
97d20d37d21b8d427a920e211858172f0a82427epoirier * by the 'Require' directive). It runs after the access_checker hook, and
97d20d37d21b8d427a920e211858172f0a82427epoirier * before the auth_checker hook.
97d20d37d21b8d427a920e211858172f0a82427epoirier *
97d20d37d21b8d427a920e211858172f0a82427epoirier * @param r The current request
dc80439e9fba60c753cd145cb6799409ffea9b71ronald * @return OK, DECLINED, or HTTP_...
97d20d37d21b8d427a920e211858172f0a82427epoirier * @ingroup hooks
97d20d37d21b8d427a920e211858172f0a82427epoirier */
dc80439e9fba60c753cd145cb6799409ffea9b71ronaldAP_DECLARE_HOOK(int,check_user_id,(request_rec *r))
dc80439e9fba60c753cd145cb6799409ffea9b71ronald
97d20d37d21b8d427a920e211858172f0a82427epoirier/**
97d20d37d21b8d427a920e211858172f0a82427epoirier * Allows modules to perform module-specific fixing of header fields. This
dc80439e9fba60c753cd145cb6799409ffea9b71ronald * is invoked just before any content-handler
0ec6007a40ac877a7c8d87767ca8e306d89f6595aaron * @param r The current request
97d20d37d21b8d427a920e211858172f0a82427epoirier * @return OK, DECLINED, or HTTP_...
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * @ingroup hooks
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding */
0ec6007a40ac877a7c8d87767ca8e306d89f6595aaronAP_DECLARE_HOOK(int,fixups,(request_rec *r))
0ec6007a40ac877a7c8d87767ca8e306d89f6595aaron
0ec6007a40ac877a7c8d87767ca8e306d89f6595aaron/**
dc80439e9fba60c753cd145cb6799409ffea9b71ronald * This routine is called to determine and/or set the various document type
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * information bits, like Content-type (via r->content_type), language, et
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * cetera.
97d20d37d21b8d427a920e211858172f0a82427epoirier * @param r the current request
97d20d37d21b8d427a920e211858172f0a82427epoirier * @return OK, DECLINED, or HTTP_...
29c30db45f6a469017e16b606611e460cc1a1f2caaron * @ingroup hooks
29c30db45f6a469017e16b606611e460cc1a1f2caaron */
29c30db45f6a469017e16b606611e460cc1a1f2caaronAP_DECLARE_HOOK(int,type_checker,(request_rec *r))
29c30db45f6a469017e16b606611e460cc1a1f2caaron
dc80439e9fba60c753cd145cb6799409ffea9b71ronald/**
29c30db45f6a469017e16b606611e460cc1a1f2caaron * This hook is used to apply additional access control to this resource.
97d20d37d21b8d427a920e211858172f0a82427epoirier * It runs *before* a user is authenticated, so this hook is really to
dc80439e9fba60c753cd145cb6799409ffea9b71ronald * apply additional restrictions independent of a user. It also runs
dc80439e9fba60c753cd145cb6799409ffea9b71ronald * independent of 'Require' directive usage.
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding *
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * @param r the current request
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * @return OK, DECLINED, or HTTP_...
97d20d37d21b8d427a920e211858172f0a82427epoirier * @ingroup hooks
dc80439e9fba60c753cd145cb6799409ffea9b71ronald */
0ec6007a40ac877a7c8d87767ca8e306d89f6595aaronAP_DECLARE_HOOK(int,access_checker,(request_rec *r))
97d20d37d21b8d427a920e211858172f0a82427epoirier
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding/**
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * This hook is used to check to see if the resource being requested
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * is available for the authenticated user (r->user and r->ap_auth_type).
97d20d37d21b8d427a920e211858172f0a82427epoirier * It runs after the access_checker and check_user_id hooks. Note that
97d20d37d21b8d427a920e211858172f0a82427epoirier * it will *only* be called if Apache determines that access control has
97d20d37d21b8d427a920e211858172f0a82427epoirier * been applied to this resource (through a 'Require' directive).
29c30db45f6a469017e16b606611e460cc1a1f2caaron *
29c30db45f6a469017e16b606611e460cc1a1f2caaron * @param r the current request
dc80439e9fba60c753cd145cb6799409ffea9b71ronald * @return OK, DECLINED, or HTTP_...
29c30db45f6a469017e16b606611e460cc1a1f2caaron * @ingroup hooks
97d20d37d21b8d427a920e211858172f0a82427epoirier */
dc80439e9fba60c753cd145cb6799409ffea9b71ronaldAP_DECLARE_HOOK(int,auth_checker,(request_rec *r))
dc80439e9fba60c753cd145cb6799409ffea9b71ronald
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding/**
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * This hook allows modules to insert filters for the current request
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * @param r the current request
97d20d37d21b8d427a920e211858172f0a82427epoirier * @ingroup hooks
dc80439e9fba60c753cd145cb6799409ffea9b71ronald */
0ec6007a40ac877a7c8d87767ca8e306d89f6595aaronAP_DECLARE_HOOK(void,insert_filter,(request_rec *r))
97d20d37d21b8d427a920e211858172f0a82427epoirier
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingAP_DECLARE(int) ap_location_walk(request_rec *r);
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingAP_DECLARE(int) ap_directory_walk(request_rec *r);
0ec6007a40ac877a7c8d87767ca8e306d89f6595aaronAP_DECLARE(int) ap_file_walk(request_rec *r);
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding/** End Of REQUEST (EOR) bucket */
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingAP_DECLARE_DATA extern const apr_bucket_type_t ap_bucket_type_eor;
97d20d37d21b8d427a920e211858172f0a82427epoirier
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding/**
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * Determine if a bucket is an End Of REQUEST (EOR) bucket
a6b9ed64fdf548c61de9714e2cfb999ec59d149cgstein * @param e The bucket to inspect
a6b9ed64fdf548c61de9714e2cfb999ec59d149cgstein * @return true or false
a6b9ed64fdf548c61de9714e2cfb999ec59d149cgstein */
9d0665da83d1e22c0ea0e5f6f940f70f75bf5237ianh#define AP_BUCKET_IS_EOR(e) (e->type == &ap_bucket_type_eor)
e1753aabf5df187b5b04e72a958af4b65b1a125daaron
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding/**
e1753aabf5df187b5b04e72a958af4b65b1a125daaron * Make the bucket passed in an End Of REQUEST (EOR) bucket
e1753aabf5df187b5b04e72a958af4b65b1a125daaron * @param b The bucket to make into an EOR bucket
e1753aabf5df187b5b04e72a958af4b65b1a125daaron * @param r The request to destroy when this bucket is destroyed
e1753aabf5df187b5b04e72a958af4b65b1a125daaron * @return The new bucket, or NULL if allocation failed
e1753aabf5df187b5b04e72a958af4b65b1a125daaron */
e1753aabf5df187b5b04e72a958af4b65b1a125daaronAP_DECLARE(apr_bucket *) ap_bucket_eor_make(apr_bucket *b, request_rec *r);
e1753aabf5df187b5b04e72a958af4b65b1a125daaron
e1753aabf5df187b5b04e72a958af4b65b1a125daaron/**
03a0fe8ed13b5883d43e40ad99c877a24cb97bfbbnicholes * Create a bucket referring to an End Of REQUEST (EOR). This bucket
e1753aabf5df187b5b04e72a958af4b65b1a125daaron * holds a pointer to the request_rec, so that the request can be
0ec6007a40ac877a7c8d87767ca8e306d89f6595aaron * destroyed right after all of the output has been sent to the client.
0ec6007a40ac877a7c8d87767ca8e306d89f6595aaron *
e1753aabf5df187b5b04e72a958af4b65b1a125daaron * @param list The freelist from which this bucket should be allocated
e1753aabf5df187b5b04e72a958af4b65b1a125daaron * @param r The request to destroy when this bucket is destroyed
0ec6007a40ac877a7c8d87767ca8e306d89f6595aaron * @return The new bucket, or NULL if allocation failed
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding */
dc80439e9fba60c753cd145cb6799409ffea9b71ronaldAP_DECLARE(apr_bucket *) ap_bucket_eor_create(apr_bucket_alloc_t *list,
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding request_rec *r);
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#ifdef __cplusplus
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding}
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#endif
1ccd992d37d62c8cb2056126f2234f64ec189bfddougm
dc80439e9fba60c753cd145cb6799409ffea9b71ronald#endif /* !APACHE_HTTP_REQUEST_H */
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding