Apache2
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Apache Request Processing
Collaboration diagram for Apache Request Processing:

Modules

 Access Control for Sub-Requests and
 

Macros

#define AP_SUBREQ_NO_ARGS   0
 
#define AP_SUBREQ_MERGE_ARGS   1
 
#define MERGE_ALLOW   0
 
#define REPLACE_ALLOW   1
 
#define AP_BUCKET_IS_EOR(e)   (e->type == &ap_bucket_type_eor)
 

Functions

int ap_process_request_internal (request_rec *r)
 
request_recap_sub_req_lookup_uri (const char *new_uri, const request_rec *r, ap_filter_t *next_filter)
 
request_recap_sub_req_lookup_file (const char *new_file, const request_rec *r, ap_filter_t *next_filter)
 
request_recap_sub_req_lookup_dirent (const apr_finfo_t *finfo, const request_rec *r, int subtype, ap_filter_t *next_filter)
 
request_recap_sub_req_method_uri (const char *method, const char *new_uri, const request_rec *r, ap_filter_t *next_filter)
 
apr_status_t ap_sub_req_output_filter (ap_filter_t *f, apr_bucket_brigade *bb)
 
int ap_run_sub_req (request_rec *r)
 
void ap_destroy_sub_req (request_rec *r)
 
apr_status_t ap_request_core_filter (ap_filter_t *f, apr_bucket_brigade *bb)
 
void ap_internal_redirect (const char *new_uri, request_rec *r)
 
void ap_internal_redirect_handler (const char *new_uri, request_rec *r)
 
void ap_internal_fast_redirect (request_rec *sub_req, request_rec *r)
 
int ap_some_auth_required (request_rec *r)
 
apr_array_header_tauthn_ap_list_provider_names (apr_pool_t *ptemp)
 
apr_array_header_tauthz_ap_list_provider_names (apr_pool_t *ptemp)
 
int ap_is_initial_req (request_rec *r)
 
void ap_update_mtime (request_rec *r, apr_time_t dependency_mtime)
 
void ap_allow_methods (request_rec *r, int reset,...) AP_FN_ATTR_SENTINEL
 
void ap_allow_standard_methods (request_rec *r, int reset,...)
 
void ap_process_request (request_rec *r)
 
void ap_process_request_after_handler (request_rec *r)
 
void ap_process_async_request (request_rec *r)
 
void ap_die (int type, request_rec *r)
 
apr_status_t ap_check_pipeline (conn_rec *c, apr_bucket_brigade *bb, unsigned int max_blank_lines)
 
void ap_hook_check_access (ap_HOOK_access_checker_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder, int type)
 
void ap_hook_check_access_ex (ap_HOOK_access_checker_ex_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder, int type)
 
void ap_hook_check_authn (ap_HOOK_check_user_id_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder, int type)
 
void ap_hook_check_authz (ap_HOOK_auth_checker_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder, int type)
 
int ap_location_walk (request_rec *r)
 
int ap_directory_walk (request_rec *r)
 
int ap_file_walk (request_rec *r)
 
int ap_if_walk (request_rec *r)
 
apr_bucketap_bucket_eor_make (apr_bucket *b, request_rec *r)
 
apr_bucketap_bucket_eor_create (apr_bucket_alloc_t *list, request_rec *r)
 
int ap_some_authn_required (request_rec *r)
 

Variables

AP_DECLARE_DATA const
apr_bucket_type_t 
ap_bucket_type_eor
 

Detailed Description

Macro Definition Documentation

#define AP_BUCKET_IS_EOR (   e)    (e->type == &ap_bucket_type_eor)

Determine if a bucket is an End Of REQUEST (EOR) bucket

Parameters
eThe bucket to inspect
Returns
true or false
#define AP_SUBREQ_MERGE_ARGS   1
#define AP_SUBREQ_NO_ARGS   0
#define MERGE_ALLOW   0
#define REPLACE_ALLOW   1

Function Documentation

void ap_allow_methods ( request_rec r,
int  reset,
  ... 
)

Add one or more methods to the list permitted to access the resource. Usually executed by the content handler before the response header is sent, but sometimes invoked at an earlier phase if a module knows it can set the list authoritatively. Note that the methods are ADDED to any already permitted unless the reset flag is non-zero. The list is used to generate the Allow response header field when it is needed.

Parameters
rThe pointer to the request identifying the resource.
resetBoolean flag indicating whether this list should completely replace any current settings.
...A NULL-terminated list of strings, each identifying a method name to add.
Returns
None.
void ap_allow_standard_methods ( request_rec r,
int  reset,
  ... 
)

Add one or more methods to the list permitted to access the resource. Usually executed by the content handler before the response header is sent, but sometimes invoked at an earlier phase if a module knows it can set the list authoritatively. Note that the methods are ADDED to any already permitted unless the reset flag is non-zero. The list is used to generate the Allow response header field when it is needed.

Parameters
rThe pointer to the request identifying the resource.
resetBoolean flag indicating whether this list should completely replace any current settings.
...A list of method identifiers, from the "M_" series defined in httpd.h, terminated with a value of -1 (e.g., "M_GET, M_POST, M_OPTIONS, -1")
Returns
None.
apr_bucket* ap_bucket_eor_create ( apr_bucket_alloc_t list,
request_rec r 
)

Create a bucket referring to an End Of REQUEST (EOR). This bucket holds a pointer to the request_rec, so that the request can be destroyed right after all of the output has been sent to the client.

Parameters
listThe freelist from which this bucket should be allocated
rThe request to destroy when this bucket is destroyed
Returns
The new bucket, or NULL if allocation failed
apr_bucket* ap_bucket_eor_make ( apr_bucket b,
request_rec r 
)

Make the bucket passed in an End Of REQUEST (EOR) bucket

Parameters
bThe bucket to make into an EOR bucket
rThe request to destroy when this bucket is destroyed
Returns
The new bucket, or NULL if allocation failed
apr_status_t ap_check_pipeline ( conn_rec c,
apr_bucket_brigade bb,
unsigned int  max_blank_lines 
)

Check whether a connection is still established and has data available, optionnaly consuming blank lines ([CR]LF).

Parameters
cThe current connection
bbThe brigade to filter
max_blank_linesMax number of blank lines to consume, or zero to consider them as data (single read).
Returns
APR_SUCCESS: connection established with data available, APR_EAGAIN: connection established and empty, APR_NOTFOUND: too much blank lines, APR_E*: connection/general error.
void ap_destroy_sub_req ( request_rec r)

Free the memory associated with a subrequest

Parameters
rThe subrequest to finish
void ap_die ( int  type,
request_rec r 
)

Kill the current request

Parameters
typeWhy the request is dieing
rThe current request
int ap_directory_walk ( request_rec r)
int ap_file_walk ( request_rec r)
void ap_hook_check_access ( ap_HOOK_access_checker_t *  pf,
const char *const *  aszPre,
const char *const *  aszSucc,
int  nOrder,
int  type 
)

Register a hook function that will apply additional access control to the current request.

Parameters
pfAn access_checker hook function
aszPreA NULL-terminated array of strings that name modules whose hooks should precede this one
aszSuccA NULL-terminated array of strings that name modules whose hooks should succeed this one
nOrderAn integer determining order before honouring aszPre and aszSucc (for example, HOOK_MIDDLE)
typeInternal request processing mode, either AP_AUTH_INTERNAL_PER_URI or AP_AUTH_INTERNAL_PER_CONF
void ap_hook_check_access_ex ( ap_HOOK_access_checker_ex_t *  pf,
const char *const *  aszPre,
const char *const *  aszSucc,
int  nOrder,
int  type 
)

Register a hook function that will apply additional access control and/or bypass authentication for the current request.

Parameters
pfAn access_checker_ex hook function
aszPreA NULL-terminated array of strings that name modules whose hooks should precede this one
aszSuccA NULL-terminated array of strings that name modules whose hooks should succeed this one
nOrderAn integer determining order before honouring aszPre and aszSucc (for example, HOOK_MIDDLE)
typeInternal request processing mode, either AP_AUTH_INTERNAL_PER_URI or AP_AUTH_INTERNAL_PER_CONF
void ap_hook_check_authn ( ap_HOOK_check_user_id_t *  pf,
const char *const *  aszPre,
const char *const *  aszSucc,
int  nOrder,
int  type 
)

Register a hook function that will analyze the request headers, authenticate the user, and set the user information in the request record.

Parameters
pfA check_user_id hook function
aszPreA NULL-terminated array of strings that name modules whose hooks should precede this one
aszSuccA NULL-terminated array of strings that name modules whose hooks should succeed this one
nOrderAn integer determining order before honouring aszPre and aszSucc (for example, HOOK_MIDDLE)
typeInternal request processing mode, either AP_AUTH_INTERNAL_PER_URI or AP_AUTH_INTERNAL_PER_CONF
void ap_hook_check_authz ( ap_HOOK_auth_checker_t *  pf,
const char *const *  aszPre,
const char *const *  aszSucc,
int  nOrder,
int  type 
)

Register a hook function that determine if the resource being requested is available for the currently authenticated user.

Parameters
pfAn auth_checker hook function
aszPreA NULL-terminated array of strings that name modules whose hooks should precede this one
aszSuccA NULL-terminated array of strings that name modules whose hooks should succeed this one
nOrderAn integer determining order before honouring aszPre and aszSucc (for example, HOOK_MIDDLE)
typeInternal request processing mode, either AP_AUTH_INTERNAL_PER_URI or AP_AUTH_INTERNAL_PER_CONF
int ap_if_walk ( request_rec r)
void ap_internal_fast_redirect ( request_rec sub_req,
request_rec r 
)

Redirect the current request to a sub_req, merging the pools

Parameters
sub_reqA subrequest created from this request
rThe current request
Note
the sub_req's pool will be merged into r's pool, be very careful not to destroy this subrequest, it will be destroyed with the main request!
void ap_internal_redirect ( const char *  new_uri,
request_rec r 
)

Redirect the current request to some other uri

Parameters
new_uriThe URI to replace the current request with
rThe current request
void ap_internal_redirect_handler ( const char *  new_uri,
request_rec r 
)

This function is designed for things like actions or CGI scripts, when using AddHandler, and you want to preserve the content type across an internal redirect.

Parameters
new_uriThe URI to replace the current request with.
rThe current request
int ap_is_initial_req ( request_rec r)

Determine if the current request is the main request or a subrequest

Parameters
rThe current request
Returns
1 if this is the main request, 0 otherwise
int ap_location_walk ( request_rec r)
void ap_process_async_request ( request_rec r)

Process a top-level request from a client, allowing some or all of the response to remain buffered in the core output filter for later, asynchronous write completion

Parameters
rThe current request
void ap_process_request ( request_rec r)

Process a top-level request from a client, and synchronously write the response to the client

Parameters
rThe current request
void ap_process_request_after_handler ( request_rec r)
int ap_process_request_internal ( request_rec r)

An internal handler used by the ap_process_request, all subrequest mechanisms and the redirect mechanism.

Parameters
rThe request, subrequest or internal redirect to pre-process
Returns
The return code for the request
apr_status_t ap_request_core_filter ( ap_filter_t f,
apr_bucket_brigade bb 
)

An output filter to ensure that we avoid passing morphing buckets to connection filters and in so doing defeat async write completion when they are set aside. This should be inserted at the end of a request filter stack.

Parameters
fThe current filter
bbThe brigade to filter
Returns
status code
int ap_run_sub_req ( request_rec r)

Run the handler for the subrequest

Parameters
rThe subrequest to run
Returns
The return code for the subrequest
int ap_some_auth_required ( request_rec r)

Can be used within any handler to determine if any authentication is required for the current request

Parameters
rThe current request
Returns
1 if authentication is required, 0 otherwise
Bug:
Behavior changed in 2.4.x refactoring, API no longer usable
Deprecated:
See Also
ap_some_authn_required()
int ap_some_authn_required ( request_rec r)

Can be used within any handler to determine if any authentication is required for the current request. Note that if used with an access_checker hook, an access_checker_ex hook or an authz provider; the caller should take steps to avoid a loop since this function is implemented by calling these hooks.

Parameters
rThe current request
Returns
TRUE if authentication is required, FALSE otherwise
request_rec* ap_sub_req_lookup_dirent ( const apr_finfo_t finfo,
const request_rec r,
int  subtype,
ap_filter_t next_filter 
)

Create a subrequest for the given apr_dir_read result. This subrequest can be inspected to find information about the requested file

Parameters
finfoThe apr_dir_read result to lookup
rThe current request
subtypeWhat type of subrequest to perform, one of;
     AP_SUBREQ_NO_ARGS     ignore r->args and r->path_info
     AP_SUBREQ_MERGE_ARGS  merge r->args and r->path_info
next_filterThe first filter the sub_request should use. If this is NULL, it defaults to the first filter for the main request
Returns
The new request record
Note
The apr_dir_read flags value APR_FINFO_MIN|APR_FINFO_NAME flag is the minimum recommended query if the results will be passed to apr_dir_read. The file info passed must include the name, and must have the same relative directory as the current request.
request_rec* ap_sub_req_lookup_file ( const char *  new_file,
const request_rec r,
ap_filter_t next_filter 
)

Create a subrequest for the given file. This subrequest can be inspected to find information about the requested file

Parameters
new_fileThe file to lookup
rThe current request
next_filterThe first filter the sub_request should use. If this is NULL, it defaults to the first filter for the main request
Returns
The new request record
request_rec* ap_sub_req_lookup_uri ( const char *  new_uri,
const request_rec r,
ap_filter_t next_filter 
)

Create a subrequest from the given URI. This subrequest can be inspected to find information about the requested URI

Parameters
new_uriThe URI to lookup
rThe current request
next_filterThe first filter the sub_request should use. If this is NULL, it defaults to the first filter for the main request
Returns
The new request record
request_rec* ap_sub_req_method_uri ( const char *  method,
const char *  new_uri,
const request_rec r,
ap_filter_t next_filter 
)

Create a subrequest for the given URI using a specific method. This subrequest can be inspected to find information about the requested URI

Parameters
methodThe method to use in the new subrequest
new_uriThe URI to lookup
rThe current request
next_filterThe first filter the sub_request should use. If this is NULL, it defaults to the first filter for the main request
Returns
The new request record
apr_status_t ap_sub_req_output_filter ( ap_filter_t f,
apr_bucket_brigade bb 
)

An output filter to strip EOS buckets from sub-requests. This always has to be inserted at the end of a sub-requests filter stack.

Parameters
fThe current filter
bbThe brigade to filter
Returns
status code
void ap_update_mtime ( request_rec r,
apr_time_t  dependency_mtime 
)

Function to set the r->mtime field to the specified value if it's later than what's already there.

Parameters
rThe current request
dependency_mtimeTime to set the mtime to
apr_array_header_t* authn_ap_list_provider_names ( apr_pool_t ptemp)
apr_array_header_t* authz_ap_list_provider_names ( apr_pool_t ptemp)

Variable Documentation

AP_DECLARE_DATA const apr_bucket_type_t ap_bucket_type_eor

End Of REQUEST (EOR) bucket