From 93475ff831e5b81bdc14490ed6e15c24f41fd95b Mon Sep 17 00:00:00 2001 From: root Date: Fri, 23 Apr 2021 20:15:07 +0000 Subject: Log errors via the Apache log API --- lib/Apache/Inject/Handler.pm | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/Apache/Inject/Handler.pm b/lib/Apache/Inject/Handler.pm index 5a40fd8..708b68b 100644 --- a/lib/Apache/Inject/Handler.pm +++ b/lib/Apache/Inject/Handler.pm @@ -36,11 +36,11 @@ sub inject { # Validate path if ($val =~ m{^/}) { - warn "$var should not begin with slash, " - . "as it is already always relative to document root"; + $r->log_error("Inject: $var should not begin with slash, " + . "as it is already always relative to document root"); } if ($val =~ m{^../|/../|/..$}) { - warn "$var cannot extend past document root"; + $r->log_error("Inject: $var cannot extend past document root"); return; } @@ -49,7 +49,7 @@ sub inject { # Read contents of specified file open my $fh, '<', "$root/$val" or do { - warn "$var $root/$val does not exist"; + $r->log_error("Inject: $var $root/$val does not exist"); return; }; print for <$fh>; @@ -64,9 +64,8 @@ sub handler { my $content = ${$r->slurp_filename}; return DECLINED if not $content =~ /$doc/; - # Or is DocumentRoot guaranteed not to be empty? if (not $r->document_root) { - warn 'Declining request due to empty document root'; + $r->warn('Inject: Declining request due to empty document root'); return DECLINED; } -- cgit v1.2.3