diff options
author | root <root@rbsd.ankarstrom.se> | 2021-04-23 20:15:07 +0000 |
---|---|---|
committer | root <root@rbsd.ankarstrom.se> | 2021-04-23 20:15:07 +0000 |
commit | 93475ff831e5b81bdc14490ed6e15c24f41fd95b (patch) | |
tree | f0623ce3158263d8b0ac50feea1c41a363a15325 | |
parent | 52f6a565a10f454dae8e1c4d4985efe5f9661b7a (diff) | |
download | Apache-Inject-93475ff831e5b81bdc14490ed6e15c24f41fd95b.tar.gz |
Log errors via the Apache log API
-rw-r--r-- | lib/Apache/Inject/Handler.pm | 11 |
1 files 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; } |