Example 1: ,,lkjlkj
parp_entry_t:
key (string): parameter name
value (string): original parameter value
new_value (string): the modified value or NULL, to delete only the value set to "" (empty string)
delete (integer): if set != 0 the whole key/value pair is removed form the request
Example 2: ,,lkjlkj
// 1) You may use the following forward declaration if not including mod_parp.h.
APR_DECLARE_OPTIONAL_FN(char *, parp_body_data, (request_rec *, apr_size_t *));
// 2) Implement your handler using the parp_body_data() function. Don't call
// the function before mod_parp's header parser has been executed.
static int parp_appl_handler(request_rec * r) {
...
apr_size_t len;
APR_OPTIONAL_FN_TYPE(parp_body_data) *parp_appl_body_data =
APR_RETRIEVE_OPTIONAL_FN(parp_body_data);
const char *data = parp_appl_body_data(r, &len);
if(data) {
...
Example 3: ,,lkjlkj
# Enable processing of other "raw" data types:
PARP_BodyData text/plain text/xml text/html
SetEnvIf Content-Type text/plain parp
SetEnvIf Content-Type text/xml parp
SetEnvIf Content-Type text/html parp
Example 4: ,,lkjlkj
// 1) Include file providing the hook definitions.
#include "mod_parp.h"
// 2) Implement the callback function processing the parameter table.
// Note: return DECLINED on success.
static apr_status_t parp_appl_impl(request_rec *r, apr_table_t *table) {
int i;
apr_table_entry_t *e = (apr_table_entry_t *) apr_table_elts(tl)->elts;
for (i = 0; i < apr_table_elts(tl)->nelts; ++i) {
...
return DECLINED;
}
// 3) Register your method to mod_parp.
APR_OPTIONAL_HOOK(parp, hp_hook, parp_appl_impl, NULL, NULL, APR_HOOK_MIDDLE);
Example 5: ,,lkjlkj
// 1) You may use the following forward declaration if not including mod_parp.h.
APR_DECLARE_OPTIONAL_FN(apr_table_t *, parp_hp_table, (request_rec *));
// 2) Implement your handler using the parp_hp_table() function. Don't call
// the function before mod_parp's header parser has been executed.
static int parp_appl_handler(request_rec * r) {
...
APR_OPTIONAL_FN_TYPE(parp_hp_table) *parp_appl_hp_table =
APR_RETRIEVE_OPTIONAL_FN(parp_hp_table);
apt_table_t *tl = parp_appl_hp_table(r);
if(tl) {
int i;
apr_table_entry_t *e = (apr_table_entry_t *) apr_table_elts(tl)->elts;
for(i = 0; i < apr_table_elts(tl)->nelts; ++i) {
ap_rprintf(r, "%d: %s = %s\n", i,
ap_escape_html(r->pool, e[i].key),
ap_escape_html(r->pool, e[i].val));
}
}
...
Example 6: ,,lkjlkj
# Ignore parser errors:
PARP_ExitOnError 200
Example 7: ,,lkjlkj
# Load the module into your server:
LoadModule parp_module <path to module>/mod_parp.so
# activate mod_parp for all requests matching the URL /a /b but not the URL /a/upload:
SetEnvIf Request_URI ^/a.* parp
SetEnvIf Request_URI ^/a/upload.* !parp
SetEnvIf Request_URI ^/b.* parp
# suppress content types not supported by mod_parp:
SetEnvIf Content-Type text/plain !parp
SetEnvIf Content-Type text/xml !parp
SetEnvIf Content-Type text/html !parp