Skip to content

Commit 27e2201

Browse files
committed
Add log force enable / disable action
1 parent b6e285d commit 27e2201

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/mod_redirectionio.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -354,19 +354,28 @@ static apr_status_t redirectionio_filter_body_filtering(ap_filter_t *f, apr_buck
354354
}
355355

356356
static int redirectionio_log_handler(request_rec *r) {
357+
bool should_log;
357358
redirectionio_config *config = (redirectionio_config*) ap_get_module_config(r->per_dir_config, &redirectionio_module);
359+
request_rec *response = r;
358360

359361
if (config->enable != 1) {
360362
return DECLINED;
361363
}
362364

363-
if (config->enable_logs != 1) {
365+
redirectionio_context* context = ap_get_module_config(r->request_config, &redirectionio_module);
366+
367+
if (context == NULL) {
364368
return DECLINED;
365369
}
366370

367-
redirectionio_context* context = ap_get_module_config(r->request_config, &redirectionio_module);
371+
// Only trust last response for data
372+
while (response->next) {
373+
response = response->next;
374+
}
368375

369-
if (context == NULL) {
376+
should_log = redirectionio_action_should_log_request(context->action, config->enable_logs == 1, response->status);
377+
378+
if (!should_log) {
370379
return DECLINED;
371380
}
372381

0 commit comments

Comments
 (0)