diff options
author | root <root@rbsd.ankarstrom.se> | 2021-04-26 19:33:46 +0000 |
---|---|---|
committer | root <root@rbsd.ankarstrom.se> | 2021-04-26 19:33:46 +0000 |
commit | dd107ea3d822f14f08198135ae2fc5b3b1d454b6 (patch) | |
tree | c72f7e27c099aee3670ab4afcd53a9f4dc25c2ca /README | |
parent | e1c7d5442ca1d3bd67c200d2dbd94bd0e40e72bd (diff) | |
download | Apache-Inject-dd107ea3d822f14f08198135ae2fc5b3b1d454b6.tar.gz |
Fix regex bug, support HTML comments
I added \s* after <body> to match any potential newline (and, for
good measure, whitespace) after <body>. One would usually rather
have this:
<body>
My header
than this:
<body>My header
Diffstat (limited to 'README')
-rw-r--r-- | README | 50 |
1 files changed, 39 insertions, 11 deletions
@@ -4,11 +4,23 @@ NAME SYNOPSIS LoadModule perl_module libexec/apache24/mod_perl.so PerlLoadModule Apache::Inject - DocumentRoot /uar/local/www/apache24/data + DocumentRoot /usr/local/www/apache24/data + <Directory /usr/local/www/apache24/data> + # Inject both header and footer on all pages on the server Inject head.html foot.html </Directory> + <Location /blog> + # Inject only header on pages under /blog + Inject head.html + </Location> + + <Files index.html> + # Inject only footer on pages named index.html + Inject - foot.html + </Files> + DESCRIPTION Apache::Inject is a mod_perl module that adds an Apache directive called Inject. @@ -69,6 +81,22 @@ INSTALLATION relevant if you install Apache::Inject via App::Cpan, which normally runs as root. +SYNTAX + The Inject directive takes one or two arguments: + + Inject HEADER_FILE [FOOTER_FILE] + + Each argument can consist of one of two things: + + 1. the path to a file relative to the document root, or + 2. a single hyphen ("-"), signifying the absence of an argument. + + Passing a hyphen as the first argument disables the header, and passing + a hyphen as the second argument disables the footer. + + If you leave out the second argument, then it is implicitly equivalent + to a hyphen. + OPERATION Behind the scenes, the Inject directive works as an alias for PerlResponseHandler and PerlSetVar. For example, "Inject head.html @@ -86,6 +114,16 @@ OPERATION well as the contents of the "InjectHeader" and "InjectFooter" files, concatenates them intelligently and prints their combined contents. +CAVEATS + Apache::Inject::Handler uses regular expressions to determine the proper + location of the injected header. It supports all valid HTML. However, it + does not take into account that embedded CSS and JavaScript code can + contain strings that look like valid opening and closing HTML tags. + + On FreeBSD, you may need to enable the accf_http kernel module in order + for the tests to work. Note that Apache::Inject works fine without the + module; it is only the tests that require it. + DIAGNOSTICS Apache::Inject and Apache::Inject::Handler log all errors and warnings to the Apache log file. Below is a list of all issued errors and @@ -95,11 +133,6 @@ DIAGNOSTICS this means that it also declines the request, letting Apache handle it as it would if the Inject directive were not used. - Error: Argument cannot be a single space - In the current implementation, the file names given to Inject are - not allowed to consist solely of a single space, as this is a - special value signifying the absence of an argument. - Error: InjectHead/InjectFoot should not begin with slash, as it is already always relative to document root The paths given to Inject are always relative to the document root, @@ -122,11 +155,6 @@ DIAGNOSTICS This warning is issued if Apache::Inject::Handler for some reason cannot retrieve the current document root from Apache. -CAVEATS - On FreeBSD, you may need to enable the accf_http kernel module in order - for the tests to work. Note that Apache::Inject works fine without the - module; it is only the tests that require it. - AUTHOR John Ankarström, <john [at] ankarstrom.se> |