diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 06:33:51 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 06:33:51 +0000 |
commit | 4f0770f3df78ecd5dcaefbd214f7a1415366bca6 (patch) | |
tree | 72661b8f81594b855bcc967b819263f63fa30e17 /debian/perl-framework/c-modules/client_add_filter | |
parent | Adding upstream version 2.4.56. (diff) | |
download | apache2-4f0770f3df78ecd5dcaefbd214f7a1415366bca6.tar.xz apache2-4f0770f3df78ecd5dcaefbd214f7a1415366bca6.zip |
Adding debian version 2.4.56-1~deb11u2.debian/2.4.56-1_deb11u2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/perl-framework/c-modules/client_add_filter')
-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 */ +}; + |