Apache 2.X Filter Module

mod_apreq2 - DSO that ties libapreq2 to Apache HTTPD 2.X. More...

Collaboration diagram for Apache 2.X Filter Module:


#define APREQ_FILTER_NAME   "apreq2"
#define APREQ_APACHE2_MMN   20101207


apreq_handle_tapreq_handle_apache2 (request_rec *r)

Detailed Description

mod_apreq2 - DSO that ties libapreq2 to Apache HTTPD 2.X.

mod_apreq2 provides the "APREQ2" input filter for using libapreq2 (and allow its parsed data structures to be shared) within the Apache 2.X webserver. Using it, libapreq2 works properly in every phase of the HTTP request, from translation handlers to output filters, and even for subrequests / internal redirects.

Activating mod_apreq2 in Apache 2.X

The installation process triggered by % make install will not modify your webserver's config file. Hence, be sure you activate it on startup by adding a LoadModule directive to your webserver config; e.g.

LoadModule apreq_module modules/mod_apreq2.so
module AP_MODULE_DECLARE_DATA apreq_module

The mod_apreq2 filter is named "apreq2", and may be used in Apache's input filter directives, e.g.

AddInputFilter apreq2 # or
SetInputFilter apreq2

However, this is not required because libapreq2 will add the filter (only) if it's necessary. You just need to ensure that your module invokes apreq_handle_apache2() before the content handler ultimately reads from the input filter chain. It is important to realize that no matter how the input filters are initially arranged, the APREQ2 filter will attempt to reposition itself to be the last input filter to read the data.

If you want to use other input filters to transform the incoming HTTP request data, is important to register those filters with Apache as having type AP_FTYPE_CONTENT_SET or AP_FTYPE_RESOURCE. Due to the limitations of Apache's current input filter design, types higher than AP_FTYPE_CONTENT_SET may not work properly whenever the apreq filter is active.

This is especially true when a content handler uses libapreq2 to parse some of the post data before doing an internal redirect. Any input filter subsequently added to the redirected request will bypass the original apreq filter (and therefore lose access to some of the original post data), unless its type is less than the type of the apreq filter (currently AP_FTYPE_PROTOCOL-1).

Server Configuration Directives

Per-directory commands for mod_apreq2
Directive Context DefaultDescription
APREQ2_ReadLimit directory APREQ_DEFAULT_READ_LIMIT Maximum number of bytes mod_apreq2 will send off to libapreq2 for parsing. mod_apreq2 will log this event and subsequently remove itself from the filter chain.
APREQ2_BrigadeLimit directory APREQ_DEFAULT_BRIGADE_LIMIT Maximum number of bytes mod_apreq2 will let accumulate within the heap-buckets in a brigade. Excess data will be spooled to an appended file bucket.
APREQ2_TempDir directory NULL Sets the location of the temporary directory apreq will use to spool overflow brigade data (based on the APREQ2_BrigadeLimit setting). If left unset, libapreq2 will select a platform-specific location via apr_temp_dir_get().

Implementation Details

  XXX apreq as a normal input filter
  XXX apreq as a "virtual" content handler.
  XXX apreq as a transparent "tee".
  XXX apreq parser registration in post_config

Macro Definition Documentation


#define APREQ_APACHE2_MMN   20101207

The Apache2 Module Magic Number for use in the Apache 2.x module structures This gets bumped if changes in th4e API will break third party applications using this apache2 module

See also


#define APREQ_FILTER_NAME   "apreq2"

The mod_apreq2 filter is named "apreq2", and may be used in Apache's input filter directives, e.g.

AddInputFilter apreq2 # or
SetInputFilter apreq2

See above

Function Documentation

◆ apreq_handle_apache2()

apreq_handle_t * apreq_handle_apache2 ( request_rec r)

Create an apreq handle which communicates with an Apache 2.X request_rec.