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
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.
3ef7956b993aff4b4882c643910fb688a0e707e3ben * @brief Apache Request library
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * @defgroup APACHE_CORE_REQ Apache Request Processing
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * @ingroup APACHE_CORE
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh * request.c is the code which handles the main line of request
2d2eda71267231c2526be701fe655db125852c1ffielding * processing, once a request has been read in (finding the right per-
2d2eda71267231c2526be701fe655db125852c1ffielding * directory configuration, building it if necessary, and calling all
2d2eda71267231c2526be701fe655db125852c1ffielding * the module dispatch functions in the right order).
2d2eda71267231c2526be701fe655db125852c1ffielding * The pieces here which are public to the modules, allow them to learn
2d2eda71267231c2526be701fe655db125852c1ffielding * how the server would handle some other file or URI, or perhaps even
2d2eda71267231c2526be701fe655db125852c1ffielding * direct the server to serve that other file instead of the one the
2d2eda71267231c2526be701fe655db125852c1ffielding * client requested directly.
2d2eda71267231c2526be701fe655db125852c1ffielding * There are two ways to do that. The first is the sub_request mechanism,
2d2eda71267231c2526be701fe655db125852c1ffielding * which handles looking up files and URIs as adjuncts to some other
2d2eda71267231c2526be701fe655db125852c1ffielding * request (e.g., directory entries for multiviews and directory listings);
2d2eda71267231c2526be701fe655db125852c1ffielding * the lookup functions stop short of actually running the request, but
2d2eda71267231c2526be701fe655db125852c1ffielding * (e.g., for includes), a module may call for the request to be run
2d2eda71267231c2526be701fe655db125852c1ffielding * by calling run_sub_req. The space allocated to create sub_reqs can be
2d2eda71267231c2526be701fe655db125852c1ffielding * reclaimed by calling destroy_sub_req --- be sure to copy anything you care
1ccd992d37d62c8cb2056126f2234f64ec189bfddougm * about which was allocated in its apr_pool_t elsewhere before doing this.
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianhextern "C" {
0ec08ecdcb42129d147888bda504787b164da39cerikabele * An internal handler used by the ap_process_request, all subrequest mechanisms
6d7983331bf3e1e7dd2ee7c6e5f531d357e7e1aawrowe * and the redirect mechanism.
6d7983331bf3e1e7dd2ee7c6e5f531d357e7e1aawrowe * @param r The request, subrequest or internal redirect to pre-process
6d7983331bf3e1e7dd2ee7c6e5f531d357e7e1aawrowe * @return The return code for the request
6d7983331bf3e1e7dd2ee7c6e5f531d357e7e1aawroweAP_DECLARE(int) ap_process_request_internal(request_rec *r);
0ec08ecdcb42129d147888bda504787b164da39cerikabele * Create a subrequest from the given URI. This subrequest can be
4743e6e0c6d5bc44f086d4f0032ae41a68192dd1rbb * inspected to find information about the requested URI
e8eee56a2ea20f673e5942fb58e1426a7561c7acstas * @param new_uri The URI to lookup
4743e6e0c6d5bc44f086d4f0032ae41a68192dd1rbb * @param r The current request
59d7dc153347a9f606c5712f0fae7b65e96682d9rbb * @param next_filter The first filter the sub_request should use. If this is
0fbbb7938680ecde631ae30271f43a6f6240aa8cwrowe * NULL, it defaults to the first filter for the main request
4743e6e0c6d5bc44f086d4f0032ae41a68192dd1rbb * @return The new request record
e8eee56a2ea20f673e5942fb58e1426a7561c7acstasAP_DECLARE(request_rec *) ap_sub_req_lookup_uri(const char *new_uri,
0ec08ecdcb42129d147888bda504787b164da39cerikabele * Create a subrequest for the given file. This subrequest can be
4743e6e0c6d5bc44f086d4f0032ae41a68192dd1rbb * inspected to find information about the requested file
e8eee56a2ea20f673e5942fb58e1426a7561c7acstas * @param new_file The file to lookup
4743e6e0c6d5bc44f086d4f0032ae41a68192dd1rbb * @param r The current request
59d7dc153347a9f606c5712f0fae7b65e96682d9rbb * @param next_filter The first filter the sub_request should use. If this is
0fbbb7938680ecde631ae30271f43a6f6240aa8cwrowe * NULL, it defaults to the first filter for the main request
4743e6e0c6d5bc44f086d4f0032ae41a68192dd1rbb * @return The new request record
3d96ee83babeec32482c9082c9426340cee8c44dwroweAP_DECLARE(request_rec *) ap_sub_req_lookup_file(const char *new_file,
742318b93e89c311f66b55f426c4d9cf2c14628bjim * Create a subrequest for the given apr_dir_read result. This subrequest
44da058d96ca5577a8b9fe7d6b89d79fe9a0a849wrowe * can be inspected to find information about the requested file
44da058d96ca5577a8b9fe7d6b89d79fe9a0a849wrowe * @param finfo The apr_dir_read result to lookup
44da058d96ca5577a8b9fe7d6b89d79fe9a0a849wrowe * @param r The current request
3cd826b00280881e5a2f03d8ec1f8d55802b93dewrowe * @param subtype What type of subrequest to perform, one of;
3cd826b00280881e5a2f03d8ec1f8d55802b93dewrowe * AP_SUBREQ_NO_ARGS ignore r->args and r->path_info
3cd826b00280881e5a2f03d8ec1f8d55802b93dewrowe * AP_SUBREQ_MERGE_ARGS merge r->args and r->path_info
44da058d96ca5577a8b9fe7d6b89d79fe9a0a849wrowe * @param next_filter The first filter the sub_request should use. If this is
0fbbb7938680ecde631ae30271f43a6f6240aa8cwrowe * NULL, it defaults to the first filter for the main request
44da058d96ca5577a8b9fe7d6b89d79fe9a0a849wrowe * @return The new request record
742318b93e89c311f66b55f426c4d9cf2c14628bjim * @note The apr_dir_read flags value APR_FINFO_MIN|APR_FINFO_NAME flag is the
44da058d96ca5577a8b9fe7d6b89d79fe9a0a849wrowe * minimum recommended query if the results will be passed to apr_dir_read.
44da058d96ca5577a8b9fe7d6b89d79fe9a0a849wrowe * The file info passed must include the name, and must have the same relative
44da058d96ca5577a8b9fe7d6b89d79fe9a0a849wrowe * directory as the current request.
efa1a34b0a7785fc72863eff175b0cfc1ecb0e38wroweAP_DECLARE(request_rec *) ap_sub_req_lookup_dirent(const apr_finfo_t *finfo,
0ec08ecdcb42129d147888bda504787b164da39cerikabele * Create a subrequest for the given URI using a specific method. This
0ec08ecdcb42129d147888bda504787b164da39cerikabele * subrequest can be inspected to find information about the requested URI
0ec08ecdcb42129d147888bda504787b164da39cerikabele * @param method The method to use in the new subrequest
e8eee56a2ea20f673e5942fb58e1426a7561c7acstas * @param new_uri The URI to lookup
4743e6e0c6d5bc44f086d4f0032ae41a68192dd1rbb * @param r The current request
59d7dc153347a9f606c5712f0fae7b65e96682d9rbb * @param next_filter The first filter the sub_request should use. If this is
59d7dc153347a9f606c5712f0fae7b65e96682d9rbb * NULL, it defaults to the first filter for the main request
4743e6e0c6d5bc44f086d4f0032ae41a68192dd1rbb * @return The new request record
3d96ee83babeec32482c9082c9426340cee8c44dwroweAP_DECLARE(request_rec *) ap_sub_req_method_uri(const char *method,
e8eee56a2ea20f673e5942fb58e1426a7561c7acstas const char *new_uri,
dd95dce618f5c95c71733a363f7e3c8acb02f8d4rbb * An output filter to strip EOS buckets from sub-requests. This always
dd95dce618f5c95c71733a363f7e3c8acb02f8d4rbb * has to be inserted at the end of a sub-requests filter stack.
dd95dce618f5c95c71733a363f7e3c8acb02f8d4rbb * @param f The current filter
dd95dce618f5c95c71733a363f7e3c8acb02f8d4rbb * @param bb The brigade to filter
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh * @return status code
f0c7e2f3f183d7c289eb176434d68a922b66a008wroweAP_CORE_DECLARE_NONSTD(apr_status_t) ap_sub_req_output_filter(ap_filter_t *f,
0ec08ecdcb42129d147888bda504787b164da39cerikabele * Run the handler for the subrequest
0ec08ecdcb42129d147888bda504787b164da39cerikabele * @param r The subrequest to run
0ec08ecdcb42129d147888bda504787b164da39cerikabele * @return The return code for the subrequest
0ec08ecdcb42129d147888bda504787b164da39cerikabele * Free the memory associated with a subrequest
0ec08ecdcb42129d147888bda504787b164da39cerikabele * @param r The subrequest to finish
2d2eda71267231c2526be701fe655db125852c1ffielding * Then there's the case that you want some other request to be served
2d2eda71267231c2526be701fe655db125852c1ffielding * as the top-level request INSTEAD of what the client requested directly.
2d2eda71267231c2526be701fe655db125852c1ffielding * If so, call this from a handler, and then immediately return OK.
4743e6e0c6d5bc44f086d4f0032ae41a68192dd1rbb * Redirect the current request to some other uri
4743e6e0c6d5bc44f086d4f0032ae41a68192dd1rbb * @param new_uri The URI to replace the current request with
4743e6e0c6d5bc44f086d4f0032ae41a68192dd1rbb * @param r The current request
3d96ee83babeec32482c9082c9426340cee8c44dwroweAP_DECLARE(void) ap_internal_redirect(const char *new_uri, request_rec *r);
4743e6e0c6d5bc44f086d4f0032ae41a68192dd1rbb * This function is designed for things like actions or CGI scripts, when
4743e6e0c6d5bc44f086d4f0032ae41a68192dd1rbb * using AddHandler, and you want to preserve the content type across
4743e6e0c6d5bc44f086d4f0032ae41a68192dd1rbb * an internal redirect.
4743e6e0c6d5bc44f086d4f0032ae41a68192dd1rbb * @param new_uri The URI to replace the current request with.
4743e6e0c6d5bc44f086d4f0032ae41a68192dd1rbb * @param r The current request
3d96ee83babeec32482c9082c9426340cee8c44dwroweAP_DECLARE(void) ap_internal_redirect_handler(const char *new_uri, request_rec *r);
299509b1b45b2fc814f1d57bf93171439295b25ewrowe * Redirect the current request to a sub_req, merging the pools
299509b1b45b2fc814f1d57bf93171439295b25ewrowe * @param sub_req A subrequest created from this request
299509b1b45b2fc814f1d57bf93171439295b25ewrowe * @param r The current request
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh * @note the sub_req's pool will be merged into r's pool, be very careful
299509b1b45b2fc814f1d57bf93171439295b25ewrowe * not to destroy this subrequest, it will be destroyed with the main request!
0af60abaab15a77583f712ba8ea5ad0e027a1d21wroweAP_DECLARE(void) ap_internal_fast_redirect(request_rec *sub_req, request_rec *r);
4743e6e0c6d5bc44f086d4f0032ae41a68192dd1rbb * Can be used within any handler to determine if any authentication
4743e6e0c6d5bc44f086d4f0032ae41a68192dd1rbb * is required for the current request
4743e6e0c6d5bc44f086d4f0032ae41a68192dd1rbb * @param r The current request
4743e6e0c6d5bc44f086d4f0032ae41a68192dd1rbb * @return 1 if authentication is required, 0 otherwise
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * @defgroup APACHE_CORE_REQ_AUTH Access Control for Sub-Requests and
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * Internal Redirects
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * @ingroup APACHE_CORE_REQ
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd#define AP_AUTH_INTERNAL_PER_URI 0 /**< Run access control hooks on all
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd internal requests with URIs
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd distinct from that of initial
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd#define AP_AUTH_INTERNAL_PER_CONF 1 /**< Run access control hooks only on
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd internal requests with
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd configurations distinct from
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd that of initial request */
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd#define AP_AUTH_INTERNAL_MASK 0x000F /**< mask to extract internal request
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd processing mode */
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * Clear flag which determines when access control hooks will be run for
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * internal requests.
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * Determine whether access control hooks will be run for all internal
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * requests with URIs distinct from that of the initial request, or only
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * those for which different configurations apply than those which applied
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * to the initial request. To accomodate legacy external modules which
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * may expect access control hooks to be run for all internal requests
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * with distinct URIs, this is the default behaviour unless all access
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * control hooks and authentication and authorization providers are
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * registered with AP_AUTH_INTERNAL_PER_CONF.
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * @param ptemp Pool used for temporary allocations
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisdAP_DECLARE(void) ap_setup_auth_internal(apr_pool_t *ptemp);
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * Register an authentication or authorization provider with the global
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * provider pool.
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * @param pool The pool to create any storage from
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * @param provider_group The group to store the provider in
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * @param provider_name The name for this provider
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * @param provider_version The version for this provider
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * @param provider Opaque structure for this provider
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * @param type Internal request processing mode, either
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * AP_AUTH_INTERNAL_PER_URI or AP_AUTH_INTERNAL_PER_CONF
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * @return APR_SUCCESS if all went well
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisdAP_DECLARE(apr_status_t) ap_register_auth_provider(apr_pool_t *pool,
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd const void *provider,
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd/* Optional functions coming from mod_authn_core and mod_authz_core
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * that list all registered authn/z providers.
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisdAPR_DECLARE_OPTIONAL_FN(apr_array_header_t *, authn_ap_list_provider_names,
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisdAPR_DECLARE_OPTIONAL_FN(apr_array_header_t *, authz_ap_list_provider_names,
0ec08ecdcb42129d147888bda504787b164da39cerikabele * Determine if the current request is the main request or a subrequest
4743e6e0c6d5bc44f086d4f0032ae41a68192dd1rbb * @param r The current request
0ec08ecdcb42129d147888bda504787b164da39cerikabele * @return 1 if this is the main request, 0 otherwise
4743e6e0c6d5bc44f086d4f0032ae41a68192dd1rbb * Function to set the r->mtime field to the specified value if it's later
4743e6e0c6d5bc44f086d4f0032ae41a68192dd1rbb * than what's already there.
4743e6e0c6d5bc44f086d4f0032ae41a68192dd1rbb * @param r The current request
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh * @param dependency_mtime Time to set the mtime to
3d96ee83babeec32482c9082c9426340cee8c44dwroweAP_DECLARE(void) ap_update_mtime(request_rec *r, apr_time_t dependency_mtime);
5d54ba1fdf6f8d7167fafcd93bef30df3906b1aecoar * Add one or more methods to the list permitted to access the resource.
5d54ba1fdf6f8d7167fafcd93bef30df3906b1aecoar * Usually executed by the content handler before the response header is
5d54ba1fdf6f8d7167fafcd93bef30df3906b1aecoar * sent, but sometimes invoked at an earlier phase if a module knows it
5d54ba1fdf6f8d7167fafcd93bef30df3906b1aecoar * can set the list authoritatively. Note that the methods are ADDED
5d54ba1fdf6f8d7167fafcd93bef30df3906b1aecoar * to any already permitted unless the reset flag is non-zero. The
5d54ba1fdf6f8d7167fafcd93bef30df3906b1aecoar * list is used to generate the Allow response header field when it
5d54ba1fdf6f8d7167fafcd93bef30df3906b1aecoar * is needed.
5d54ba1fdf6f8d7167fafcd93bef30df3906b1aecoar * @param r The pointer to the request identifying the resource.
5d54ba1fdf6f8d7167fafcd93bef30df3906b1aecoar * @param reset Boolean flag indicating whether this list should
5d54ba1fdf6f8d7167fafcd93bef30df3906b1aecoar * completely replace any current settings.
5d54ba1fdf6f8d7167fafcd93bef30df3906b1aecoar * @param ... A NULL-terminated list of strings, each identifying a
5d54ba1fdf6f8d7167fafcd93bef30df3906b1aecoar * method name to add.
5d54ba1fdf6f8d7167fafcd93bef30df3906b1aecoar * @return None.
64945a581b504264270920efbad4f6af0d5a1978sfAP_DECLARE(void) ap_allow_methods(request_rec *r, int reset, ...)
798c7c11dc2fe3b08e591e9c76fc1a84857f2cd4jerenkrantz * Add one or more methods to the list permitted to access the resource.
798c7c11dc2fe3b08e591e9c76fc1a84857f2cd4jerenkrantz * Usually executed by the content handler before the response header is
798c7c11dc2fe3b08e591e9c76fc1a84857f2cd4jerenkrantz * sent, but sometimes invoked at an earlier phase if a module knows it
798c7c11dc2fe3b08e591e9c76fc1a84857f2cd4jerenkrantz * can set the list authoritatively. Note that the methods are ADDED
798c7c11dc2fe3b08e591e9c76fc1a84857f2cd4jerenkrantz * to any already permitted unless the reset flag is non-zero. The
798c7c11dc2fe3b08e591e9c76fc1a84857f2cd4jerenkrantz * list is used to generate the Allow response header field when it
798c7c11dc2fe3b08e591e9c76fc1a84857f2cd4jerenkrantz * is needed.
798c7c11dc2fe3b08e591e9c76fc1a84857f2cd4jerenkrantz * @param r The pointer to the request identifying the resource.
798c7c11dc2fe3b08e591e9c76fc1a84857f2cd4jerenkrantz * @param reset Boolean flag indicating whether this list should
798c7c11dc2fe3b08e591e9c76fc1a84857f2cd4jerenkrantz * completely replace any current settings.
798c7c11dc2fe3b08e591e9c76fc1a84857f2cd4jerenkrantz * @param ... A list of method identifiers, from the "M_" series
798c7c11dc2fe3b08e591e9c76fc1a84857f2cd4jerenkrantz * defined in httpd.h, terminated with a value of -1
798c7c11dc2fe3b08e591e9c76fc1a84857f2cd4jerenkrantz * (e.g., "M_GET, M_POST, M_OPTIONS, -1")
798c7c11dc2fe3b08e591e9c76fc1a84857f2cd4jerenkrantz * @return None.
798c7c11dc2fe3b08e591e9c76fc1a84857f2cd4jerenkrantzAP_DECLARE(void) ap_allow_standard_methods(request_rec *r, int reset, ...);
a623efbff95aab78da9e030524b0fa69b054f6d0brianp * Process a top-level request from a client, and synchronously write
a623efbff95aab78da9e030524b0fa69b054f6d0brianp * the response to the client
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh * @param r The current request
742318b93e89c311f66b55f426c4d9cf2c14628bjim/* For post-processing after a handler has finished with a request.
30b844a6f66814543b85fc0875bb937bd8cc93abwrowe * (Commonly used after it was suspended)
30b844a6f66814543b85fc0875bb937bd8cc93abwroweAP_DECLARE(void) ap_process_request_after_handler(request_rec *r);
a623efbff95aab78da9e030524b0fa69b054f6d0brianp * Process a top-level request from a client, allowing some or all of
a623efbff95aab78da9e030524b0fa69b054f6d0brianp * the response to remain buffered in the core output filter for later,
a623efbff95aab78da9e030524b0fa69b054f6d0brianp * asynchronous write completion
a623efbff95aab78da9e030524b0fa69b054f6d0brianp * @param r The current request
4743e6e0c6d5bc44f086d4f0032ae41a68192dd1rbb * Kill the current request
4743e6e0c6d5bc44f086d4f0032ae41a68192dd1rbb * @param type Why the request is dieing
4743e6e0c6d5bc44f086d4f0032ae41a68192dd1rbb * @param r The current request
3ef7956b993aff4b4882c643910fb688a0e707e3ben/* Hooks */
b45c1c292ff1fa635004ae81fa691f8cb3cdda85rbb * Gives modules a chance to create their request_config entry when the
b45c1c292ff1fa635004ae81fa691f8cb3cdda85rbb * request is created.
b45c1c292ff1fa635004ae81fa691f8cb3cdda85rbb * @param r The current request
b45c1c292ff1fa635004ae81fa691f8cb3cdda85rbb * @ingroup hooks
4743e6e0c6d5bc44f086d4f0032ae41a68192dd1rbb * This hook allow modules an opportunity to translate the URI into an
4743e6e0c6d5bc44f086d4f0032ae41a68192dd1rbb * actual filename. If no modules do anything special, the server's default
4743e6e0c6d5bc44f086d4f0032ae41a68192dd1rbb * rules will be followed.
4743e6e0c6d5bc44f086d4f0032ae41a68192dd1rbb * @param r The current request
4743e6e0c6d5bc44f086d4f0032ae41a68192dd1rbb * @return OK, DECLINED, or HTTP_...
3ef7956b993aff4b4882c643910fb688a0e707e3ben * @ingroup hooks
a2a0abd88b19e042a3eb2a9fa1702c25ad51303dwrowe * This hook allow modules to set the per_dir_config based on their own
742318b93e89c311f66b55f426c4d9cf2c14628bjim * context (such as "<Proxy>" sections) and responds to contextless requests
a2a0abd88b19e042a3eb2a9fa1702c25ad51303dwrowe * such as TRACE that need no security or filesystem mapping.
a2a0abd88b19e042a3eb2a9fa1702c25ad51303dwrowe * based on the filesystem.
a2a0abd88b19e042a3eb2a9fa1702c25ad51303dwrowe * @param r The current request
742318b93e89c311f66b55f426c4d9cf2c14628bjim * @return DONE (or HTTP_) if this contextless request was just fulfilled
a2a0abd88b19e042a3eb2a9fa1702c25ad51303dwrowe * (such as TRACE), OK if this is not a file, and DECLINED if this is a file.
e8eee56a2ea20f673e5942fb58e1426a7561c7acstas * The core map_to_storage (HOOK_RUN_REALLY_LAST) will directory_walk
e8eee56a2ea20f673e5942fb58e1426a7561c7acstas * and file_walk the r->filename.
a2a0abd88b19e042a3eb2a9fa1702c25ad51303dwrowe * @ingroup hooks
8476daed795d573496033d88015364df09fe9c68gstein * This hook is used to analyze the request headers, authenticate the user,
8476daed795d573496033d88015364df09fe9c68gstein * and set the user information in the request record (r->user and
8476daed795d573496033d88015364df09fe9c68gstein * r->ap_auth_type). This hook is only run when Apache determines that
8476daed795d573496033d88015364df09fe9c68gstein * authentication/authorization is required for this resource (as determined
8476daed795d573496033d88015364df09fe9c68gstein * by the 'Require' directive). It runs after the access_checker hook, and
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * before the auth_checker hook. This hook should be registered with
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * ap_hook_check_authn().
24e11df946866bb8282bf2498ce21b03f1f6addccovener * If "Satisfy any" is in effect, this hook may be skipped.
4743e6e0c6d5bc44f086d4f0032ae41a68192dd1rbb * @param r The current request
4743e6e0c6d5bc44f086d4f0032ae41a68192dd1rbb * @return OK, DECLINED, or HTTP_...
3ef7956b993aff4b4882c643910fb688a0e707e3ben * @ingroup hooks
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * @see ap_hook_check_authn
4743e6e0c6d5bc44f086d4f0032ae41a68192dd1rbb * Allows modules to perform module-specific fixing of header fields. This
4743e6e0c6d5bc44f086d4f0032ae41a68192dd1rbb * is invoked just before any content-handler
4743e6e0c6d5bc44f086d4f0032ae41a68192dd1rbb * @param r The current request
4743e6e0c6d5bc44f086d4f0032ae41a68192dd1rbb * @return OK, DECLINED, or HTTP_...
3ef7956b993aff4b4882c643910fb688a0e707e3ben * @ingroup hooks
4743e6e0c6d5bc44f086d4f0032ae41a68192dd1rbb * This routine is called to determine and/or set the various document type
4743e6e0c6d5bc44f086d4f0032ae41a68192dd1rbb * information bits, like Content-type (via r->content_type), language, et
4743e6e0c6d5bc44f086d4f0032ae41a68192dd1rbb * @param r the current request
4743e6e0c6d5bc44f086d4f0032ae41a68192dd1rbb * @return OK, DECLINED, or HTTP_...
3ef7956b993aff4b4882c643910fb688a0e707e3ben * @ingroup hooks
8476daed795d573496033d88015364df09fe9c68gstein * This hook is used to apply additional access control to this resource.
8476daed795d573496033d88015364df09fe9c68gstein * It runs *before* a user is authenticated, so this hook is really to
8476daed795d573496033d88015364df09fe9c68gstein * apply additional restrictions independent of a user. It also runs
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * independent of 'Require' directive usage. This hook should be registered
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * with ap_hook_check_access().
4743e6e0c6d5bc44f086d4f0032ae41a68192dd1rbb * @param r the current request
4743e6e0c6d5bc44f086d4f0032ae41a68192dd1rbb * @return OK, DECLINED, or HTTP_...
3ef7956b993aff4b4882c643910fb688a0e707e3ben * @ingroup hooks
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * @see ap_hook_check_access
18b5268e013574026b2503b1641baf3299045f45sf * This hook is used to apply additional access control and/or bypass
18b5268e013574026b2503b1641baf3299045f45sf * authentication for this resource. It runs *before* a user is authenticated,
8e83fe1adac0c25d78d416b278ba1a7d1eb889e2covener * but after the access_checker hook.
18b5268e013574026b2503b1641baf3299045f45sf * This hook should be registered with ap_hook_check_access_ex().
24e11df946866bb8282bf2498ce21b03f1f6addccovener * If "Satisfy any" is in effect, this hook may be skipped.
18b5268e013574026b2503b1641baf3299045f45sf * @param r the current request
18b5268e013574026b2503b1641baf3299045f45sf * @return OK (allow acces), DECLINED (let later modules decide),
18b5268e013574026b2503b1641baf3299045f45sf * or HTTP_... (deny access)
18b5268e013574026b2503b1641baf3299045f45sf * @ingroup hooks
18b5268e013574026b2503b1641baf3299045f45sf * @see ap_hook_check_access_ex
8476daed795d573496033d88015364df09fe9c68gstein * This hook is used to check to see if the resource being requested
8476daed795d573496033d88015364df09fe9c68gstein * is available for the authenticated user (r->user and r->ap_auth_type).
8476daed795d573496033d88015364df09fe9c68gstein * It runs after the access_checker and check_user_id hooks. Note that
8476daed795d573496033d88015364df09fe9c68gstein * it will *only* be called if Apache determines that access control has
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * been applied to this resource (through a 'Require' directive). This
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * hook should be registered with ap_hook_check_authz().
24e11df946866bb8282bf2498ce21b03f1f6addccovener * If "Satisfy any" is in effect, this hook may be skipped.
4743e6e0c6d5bc44f086d4f0032ae41a68192dd1rbb * @param r the current request
4743e6e0c6d5bc44f086d4f0032ae41a68192dd1rbb * @return OK, DECLINED, or HTTP_...
3ef7956b993aff4b4882c643910fb688a0e707e3ben * @ingroup hooks
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * @see ap_hook_check_authz
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * Register a hook function that will apply additional access control to
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * the current request.
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * @param pf An access_checker hook function
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * @param aszPre A NULL-terminated array of strings that name modules whose
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * hooks should precede this one
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * @param aszSucc A NULL-terminated array of strings that name modules whose
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * hooks should succeed this one
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * @param nOrder An integer determining order before honouring aszPre and
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * aszSucc (for example, HOOK_MIDDLE)
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * @param type Internal request processing mode, either
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * AP_AUTH_INTERNAL_PER_URI or AP_AUTH_INTERNAL_PER_CONF
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisdAP_DECLARE(void) ap_hook_check_access(ap_HOOK_access_checker_t *pf,
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd const char * const *aszPre,
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd const char * const *aszSucc,
742318b93e89c311f66b55f426c4d9cf2c14628bjim * Register a hook function that will apply additional access control
18b5268e013574026b2503b1641baf3299045f45sf * and/or bypass authentication for the current request.
18b5268e013574026b2503b1641baf3299045f45sf * @param pf An access_checker_ex hook function
18b5268e013574026b2503b1641baf3299045f45sf * @param aszPre A NULL-terminated array of strings that name modules whose
18b5268e013574026b2503b1641baf3299045f45sf * hooks should precede this one
18b5268e013574026b2503b1641baf3299045f45sf * @param aszSucc A NULL-terminated array of strings that name modules whose
18b5268e013574026b2503b1641baf3299045f45sf * hooks should succeed this one
18b5268e013574026b2503b1641baf3299045f45sf * @param nOrder An integer determining order before honouring aszPre and
18b5268e013574026b2503b1641baf3299045f45sf * aszSucc (for example, HOOK_MIDDLE)
18b5268e013574026b2503b1641baf3299045f45sf * @param type Internal request processing mode, either
18b5268e013574026b2503b1641baf3299045f45sf * AP_AUTH_INTERNAL_PER_URI or AP_AUTH_INTERNAL_PER_CONF
18b5268e013574026b2503b1641baf3299045f45sfAP_DECLARE(void) ap_hook_check_access_ex(ap_HOOK_access_checker_ex_t *pf,
18b5268e013574026b2503b1641baf3299045f45sf const char * const *aszPre,
18b5268e013574026b2503b1641baf3299045f45sf const char * const *aszSucc,
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * Register a hook function that will analyze the request headers,
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * authenticate the user, and set the user information in the request record.
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * @param pf A check_user_id hook function
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * @param aszPre A NULL-terminated array of strings that name modules whose
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * hooks should precede this one
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * @param aszSucc A NULL-terminated array of strings that name modules whose
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * hooks should succeed this one
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * @param nOrder An integer determining order before honouring aszPre and
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * aszSucc (for example, HOOK_MIDDLE)
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * @param type Internal request processing mode, either
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * AP_AUTH_INTERNAL_PER_URI or AP_AUTH_INTERNAL_PER_CONF
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisdAP_DECLARE(void) ap_hook_check_authn(ap_HOOK_check_user_id_t *pf,
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd const char * const *aszPre,
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd const char * const *aszSucc,
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * Register a hook function that determine if the resource being requested
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * is available for the currently authenticated user.
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * @param pf An auth_checker hook function
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * @param aszPre A NULL-terminated array of strings that name modules whose
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * hooks should precede this one
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * @param aszSucc A NULL-terminated array of strings that name modules whose
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * hooks should succeed this one
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * @param nOrder An integer determining order before honouring aszPre and
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * aszSucc (for example, HOOK_MIDDLE)
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * @param type Internal request processing mode, either
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd * AP_AUTH_INTERNAL_PER_URI or AP_AUTH_INTERNAL_PER_CONF
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisdAP_DECLARE(void) ap_hook_check_authz(ap_HOOK_auth_checker_t *pf,
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd const char * const *aszPre,
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd const char * const *aszSucc,
4743e6e0c6d5bc44f086d4f0032ae41a68192dd1rbb * This hook allows modules to insert filters for the current request
4743e6e0c6d5bc44f086d4f0032ae41a68192dd1rbb * @param r the current request
3ef7956b993aff4b4882c643910fb688a0e707e3ben * @ingroup hooks
60a765cccbd3f3b5997b65b0034220c79f78369etrawick * This hook allows modules to affect the request immediately after the
60a765cccbd3f3b5997b65b0034220c79f78369etrawick * per-directory configuration for the request has been generated.
60a765cccbd3f3b5997b65b0034220c79f78369etrawick * @param r The current request
60a765cccbd3f3b5997b65b0034220c79f78369etrawick * @return OK (allow acces), DECLINED (let later modules decide),
60a765cccbd3f3b5997b65b0034220c79f78369etrawick * or HTTP_... (deny access)
60a765cccbd3f3b5997b65b0034220c79f78369etrawick * @ingroup hooks
60a765cccbd3f3b5997b65b0034220c79f78369etrawickAP_DECLARE_HOOK(int,post_perdir_config,(request_rec *r))
f4ca9f6f002fece336168a16355434ca966f96a9trawick * This hook allows modules to handle/emulate the apr_stat() calls
f4ca9f6f002fece336168a16355434ca966f96a9trawick * needed for directory walk.
45e758263f827975c224fe7778aaf75789ab900bsf * @param finfo where to put the stat data
f4ca9f6f002fece336168a16355434ca966f96a9trawick * @param r The current request
45e758263f827975c224fe7778aaf75789ab900bsf * @param wanted APR_FINFO_* flags to pass to apr_stat()
f4ca9f6f002fece336168a16355434ca966f96a9trawick * @return apr_status_t or AP_DECLINED (let later modules decide)
f4ca9f6f002fece336168a16355434ca966f96a9trawick * @ingroup hooks
f4ca9f6f002fece336168a16355434ca966f96a9trawickAP_DECLARE_HOOK(apr_status_t,dirwalk_stat,(apr_finfo_t *finfo, request_rec *r, apr_int32_t wanted))
a623efbff95aab78da9e030524b0fa69b054f6d0brianp/** End Of REQUEST (EOR) bucket */
a623efbff95aab78da9e030524b0fa69b054f6d0brianpAP_DECLARE_DATA extern const apr_bucket_type_t ap_bucket_type_eor;
a623efbff95aab78da9e030524b0fa69b054f6d0brianp * Determine if a bucket is an End Of REQUEST (EOR) bucket
a623efbff95aab78da9e030524b0fa69b054f6d0brianp * @param e The bucket to inspect
a623efbff95aab78da9e030524b0fa69b054f6d0brianp * @return true or false
a623efbff95aab78da9e030524b0fa69b054f6d0brianp#define AP_BUCKET_IS_EOR(e) (e->type == &ap_bucket_type_eor)
a623efbff95aab78da9e030524b0fa69b054f6d0brianp * Make the bucket passed in an End Of REQUEST (EOR) bucket
a623efbff95aab78da9e030524b0fa69b054f6d0brianp * @param b The bucket to make into an EOR bucket
a623efbff95aab78da9e030524b0fa69b054f6d0brianp * @param r The request to destroy when this bucket is destroyed
a623efbff95aab78da9e030524b0fa69b054f6d0brianp * @return The new bucket, or NULL if allocation failed
a623efbff95aab78da9e030524b0fa69b054f6d0brianpAP_DECLARE(apr_bucket *) ap_bucket_eor_make(apr_bucket *b, request_rec *r);
a623efbff95aab78da9e030524b0fa69b054f6d0brianp * Create a bucket referring to an End Of REQUEST (EOR). This bucket
a623efbff95aab78da9e030524b0fa69b054f6d0brianp * holds a pointer to the request_rec, so that the request can be
a623efbff95aab78da9e030524b0fa69b054f6d0brianp * destroyed right after all of the output has been sent to the client.
a623efbff95aab78da9e030524b0fa69b054f6d0brianp * @param list The freelist from which this bucket should be allocated
a623efbff95aab78da9e030524b0fa69b054f6d0brianp * @param r The request to destroy when this bucket is destroyed
a623efbff95aab78da9e030524b0fa69b054f6d0brianp * @return The new bucket, or NULL if allocation failed
a623efbff95aab78da9e030524b0fa69b054f6d0brianpAP_DECLARE(apr_bucket *) ap_bucket_eor_create(apr_bucket_alloc_t *list,
11e076839c8d5a82d55e710194d0daac51390dbdsf#endif /* !APACHE_HTTP_REQUEST_H */