diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 15:01:31 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 15:01:31 +0000 |
commit | c9cf025fadfe043f0f2f679e10d1207d8a158bb6 (patch) | |
tree | 3a94effe0bdc0a6814d8134f4ed840d7cc6b6f19 /debian/perl-framework/c-modules/client_add_filter/mod_client_add_filter.c | |
parent | Adding upstream version 2.4.57. (diff) | |
download | apache2-c9cf025fadfe043f0f2f679e10d1207d8a158bb6.tar.xz apache2-c9cf025fadfe043f0f2f679e10d1207d8a158bb6.zip |
Adding debian version 2.4.57-2.debian/2.4.57-2debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | debian/perl-framework/c-modules/client_add_filter/mod_client_add_filter.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/debian/perl-framework/c-modules/client_add_filter/mod_client_add_filter.c b/debian/perl-framework/c-modules/client_add_filter/mod_client_add_filter.c new file mode 100644 index 0000000..ce5ef99 --- /dev/null +++ b/debian/perl-framework/c-modules/client_add_filter/mod_client_add_filter.c @@ -0,0 +1,54 @@ +#define HTTPD_TEST_REQUIRE_APACHE 2 + +#include "httpd.h" +#include "http_config.h" +#include "http_protocol.h" +#include "http_request.h" +#include "http_log.h" +#include "ap_config.h" + +/* + * in real life we'd never allow the client to configure filters. + * the purpose of this module is to let .t tests configure filters + * this allows to test non-filtered and filtered requests without + * duplicating lots of test configuration + */ + +static int client_add_filter_header(void *data, + const char *key, + const char *val) +{ + request_rec *r = (request_rec *)data; + + if (strcasecmp(key, "X-AddInputFilter") == 0) { + ap_add_input_filter(val, NULL, r, r->connection); + } + else if (strcasecmp(key, "X-AddOutputFilter") == 0) { + ap_add_output_filter(val, NULL, r, r->connection); + } + + return 1; +} + +static void client_add_filter_insert(request_rec *r) +{ + apr_table_do(client_add_filter_header, (void*)r, + r->headers_in, NULL); +} + +static void client_add_filter_register_hooks(apr_pool_t *p) +{ + ap_hook_insert_filter(client_add_filter_insert, + NULL, NULL, APR_HOOK_LAST); +} + +module AP_MODULE_DECLARE_DATA client_add_filter_module = { + STANDARD20_MODULE_STUFF, + NULL, /* create per-dir config structures */ + NULL, /* merge per-dir config structures */ + NULL, /* create per-server config structures */ + NULL, /* merge per-server config structures */ + NULL, /* table of config file commands */ + client_add_filter_register_hooks /* register hooks */ +}; + |