Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 69e06fec96869a4c992dcb5fd4a059b2 > files > 7

apache-mod_injection-0.3.1-11mdv2010.0.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>mod_injection Users Manual</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"></HEAD
><BODY
CLASS="BOOK"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="BOOK"
><A
NAME="index"
></A
><DIV
CLASS="TITLEPAGE"
><H1
CLASS="TITLE"
><A
NAME="AEN2"
>mod_injection Users Manual</A
></H1
>	    <H3
CLASS="AUTHOR"
><A
NAME="AEN5"
></A
>Peter Jones</H3
><DIV
CLASS="AFFILIATION"
>		    <DIV
CLASS="ADDRESS"
><P
CLASS="ADDRESS"
>			<CODE
CLASS="EMAIL"
>&#60;<A
HREF="mailto:pjones@pmade.org"
>pjones@pmade.org</A
>&#62;</CODE
><br>
		&nbsp;&nbsp;&nbsp;&nbsp;</P
></DIV
>
		</DIV
>
	<P
CLASS="COPYRIGHT"
>Copyright &copy; 2002, 2003 Peter Jones (http://pmade.org/pjones/)</P
><DIV
><DIV
CLASS="ABSTRACT"
><P
></P
><A
NAME="AEN26"
></A
>	    <P
>		This is the manual for the mod_injection Apache module.
	    </P
>

	    <P
>		The latest version of this manual can be found at
		<A
HREF="http://pmade.org/pjones/software/mod_injection/"
TARGET="_top"
>http://pmade.org/pjones/software/mod_injection/</A
>.
	    </P
>
	<P
></P
></DIV
></DIV
><DIV
CLASS="LEGALNOTICE"
><P
></P
><A
NAME="AEN17"
></A
>	    <P
>		Redistribution and use in source (SGML DocBook) and 'compiled'
		forms (SGML, HTML, PDF, PostScript, RTF and so forth) with or
		without modification, are permitted provided that the following
		conditions are met:
	    </P
>

	    <P
></P
><OL
TYPE="1"
><LI
>		    <P
>			Redistributions of source code (SGML DocBook) must retain
			the above copyright notice, this list of conditions and the
			following disclaimer as the first lines of this file
			unmodified.
		    </P
>
		</LI
><LI
>		    <P
>			Redistributions in compiled form (transformed to other DTDs,
			converted to PDF, PostScript, RTF and other formats) must
			reproduce the above copyright notice, this list of
			conditions and the following disclaimer in the documentation
			and/or other materials provided with the distribution.
		    </P
>
		</LI
></OL
>

	    <DIV
CLASS="IMPORTANT"
><BLOCKQUOTE
CLASS="IMPORTANT"
>		<P
><B
>Important: </B
>		    THIS DOCUMENTATION IS PROVIDED BY THE AUTHORS "AS IS"
		    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
		    NOT LIMITED TO, THE IMPLIED WARRANTIES OF
		    MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
		    DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
		    ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
		    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
		    PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
		    USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
		    CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
		    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
		    NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
		    USE OF THIS DOCUMENTATION, EVEN IF ADVISED OF THE
		    POSSIBILITY OF SUCH DAMAGE.
		</P
>
	    </BLOCKQUOTE
></DIV
>
	<P
></P
></DIV
><HR></DIV
><DIV
CLASS="TOC"
><DL
><DT
><B
>Table of Contents</B
></DT
><DT
>1. <A
HREF="#intro"
>Introduction</A
></DT
><DD
><DL
><DT
><A
HREF="#readme"
>What is mod_injection?</A
></DT
><DT
><A
HREF="#features"
>Features</A
></DT
></DL
></DD
><DT
>2. <A
HREF="#build"
>Building and Installing</A
></DT
><DT
>3. <A
HREF="#config"
>Apache Configuration</A
></DT
><DD
><DL
><DT
><A
HREF="#load"
>Loading the Module</A
></DT
><DT
><A
HREF="#enable"
>Enabling the Module</A
></DT
><DT
><A
HREF="#mime-type"
>Setting the MIME Type</A
></DT
><DT
><A
HREF="#reference"
>Configuration Reference</A
></DT
></DL
></DD
><DT
>A. <A
HREF="#requirements"
>Requirements</A
></DT
><DT
>B. <A
HREF="#changelog"
>Revision History</A
></DT
><DD
><DL
><DT
><A
HREF="#cl-031"
>Version 0.3.1</A
></DT
><DT
><A
HREF="#cl-030"
>Version 0.3.0</A
></DT
><DT
><A
HREF="#cl-020"
>Version 0.2.0</A
></DT
><DT
><A
HREF="#cl-010"
>Version 0.1.0</A
></DT
></DL
></DD
><DT
>C. <A
HREF="#cedits"
>Credits</A
></DT
></DL
></DIV
>    

    <DIV
CLASS="CHAPTER"
><HR><H1
><A
NAME="intro"
></A
>Chapter 1. Introduction</H1
>
    
    <DIV
CLASS="SECTION"
><HR><H2
CLASS="SECTION"
><A
NAME="readme"
>What is mod_injection?</A
></H2
>
	<P
>	    mod_injection is an Apache 2.0.X filter module. It allows you to
	    inject text in the HTTP response after a HTML tag or after any
	    given text string.  The main intention of this module is to add
	    a banner to several HTML pages on the fly.
	</P
>
    </DIV
>
    
    <DIV
CLASS="SECTION"
><HR><H2
CLASS="SECTION"
><A
NAME="features"
>Features</A
></H2
>
	<P
>	    mod_injection has the following features.
	</P
>

	<P
></P
><UL
><LI
>		<P
>		    Injection can happen after any HTML tag (default is the
		    BODY tag).
		</P
>
	    </LI
><LI
>		<P
>		    Injection can also happen after a specific text string
		    has been seen in the output.
		</P
>
	    </LI
><LI
>		<P
>		    Injection of a string from the Apache configuration
		    file.
		</P
>
	    </LI
><LI
>		<P
>		    Injection of an entire URI.
		</P
>
	    </LI
><LI
>		<P
>		    Injection is based on the Content-Type. You can specify
		    which MIME types you want to inject for.
		</P
>
	    </LI
></UL
>
    </DIV
>
    </DIV
>

    <DIV
CLASS="CHAPTER"
><HR><H1
><A
NAME="build"
></A
>Chapter 2. Building and Installing</H1
>
    
    <P
>	This section will show you how to install mod_injection using the
	supplied Makefiles.
    </P
>

    <P
></P
><UL
><LI
>	    <P
>		Make sure that apxs is either in your path or make sure that
		you give it to make like this:
		<B
CLASS="COMMAND"
>make APXS=/path/to/apxs</B
>
	    </P
>
	</LI
><LI
>	    <P
>		From the top directory, run make. This must be GNU make and
		on some systems it is called <B
CLASS="COMMAND"
>gmake</B
>.
	    </P
>
	</LI
><LI
>	    <P
>		After everything is done compiling you can run
		<B
CLASS="COMMAND"
>make install</B
>.
	    </P
>
	</LI
><LI
>	    <P
>		Update your Apache configuration file.
	    </P
>
	</LI
></UL
>
    </DIV
>

    <DIV
CLASS="CHAPTER"
><HR><H1
><A
NAME="config"
></A
>Chapter 3. Apache Configuration</H1
>
    
    <DIV
CLASS="SECTION"
><HR><H2
CLASS="SECTION"
><A
NAME="load"
>Loading the Module</A
></H2
>
	<P
>	    The first thing that you need to do is load mod_injection. If
	    your module directory is called <TT
CLASS="FILENAME"
>modules</TT
> you
	    can load mod_injection with the following Apache configuration
	    directive:
	    
	    <PRE
CLASS="SCREEN"
>LoadModule injection_module modules/mod_injection.so</PRE
>
	</P
>
    </DIV
>
    
    <DIV
CLASS="SECTION"
><HR><H2
CLASS="SECTION"
><A
NAME="enable"
>Enabling the Module</A
></H2
>
	<P
>	    Like other filter modules, there are many different ways to
	    enable mod_injection. If you wanted to link mod_injection to a
	    file extension you could do the following.
	    <PRE
CLASS="SCREEN"
>AddOutputFilter INJECTION .html</PRE
>
	</P
>

	<P
>	    Most likely you are going to want to filter all files under a
	    given directory regardless of their file extension. Here is an
	    example of an Apache directory directive that uses
	    mod_injection.

<PRE
CLASS="SCREEN"
>&#60;Directory /&#62;
    SetOutputFilter INJECTION
    InjectString "&#60;h1&#62;Injected&#60;/h1&#62;"
&#60;/Directory&#62;</PRE
>

	</P
>
    </DIV
>
    
    <DIV
CLASS="SECTION"
><HR><H2
CLASS="SECTION"
><A
NAME="mime-type"
>Setting the MIME Type</A
></H2
>
	<P
>	    By default, mod_injection only filters content that has a MIME
	    type of <CODE
CLASS="CONSTANT"
>text/html</CODE
>. You can override this
	    using the <CODE
CLASS="CONSTANT"
>InjectType</CODE
> configuration
	    directive.
	</P
>

	<P
>	    This directive can be repeated as many times as you wish. It can
	    also contain shell style glob patterns. Here is an example that
	    tells mod_injection to filter any content that has a MIME type
	    that begins with <CODE
CLASS="CONSTANT"
>text/</CODE
>.
	    <PRE
CLASS="SCREEN"
>InjectType text/*</PRE
>
	</P
>
    </DIV
>
    
    <DIV
CLASS="SECTION"
><HR><H2
CLASS="SECTION"
><A
NAME="reference"
>Configuration Reference</A
></H2
>
	<P
>	    This final section on configuration will explain all the
	    directives that mod_injection can use.
	</P
>

	<P
></P
><UL
><LI
>		<P
>		    <CODE
CLASS="CONSTANT"
>InjectTag</CODE
> - Set the tag to inject after.
		    Example: <CODE
CLASS="CONSTANT"
>InjectTag title</CODE
>
		</P
>
	    </LI
><LI
>		<P
>		    <CODE
CLASS="CONSTANT"
>InjectAfter</CODE
> - Set a string to find and inject after. 
		    Example: <CODE
CLASS="CONSTANT"
>InjectAfter "!-- here --"</CODE
>
		</P
>
	    </LI
><LI
>		<P
>		    <CODE
CLASS="CONSTANT"
>InjectString</CODE
> - Set a string to inject at the injection point.
		    Example: <CODE
CLASS="CONSTANT"
>InjectString "h1Injected!h1"</CODE
>
		</P
>
	    </LI
><LI
>		<P
>		    <CODE
CLASS="CONSTANT"
>InjectURI</CODE
> - Set the name of a URI that should be injected at the injection point.
		    Example: <CODE
CLASS="CONSTANT"
>InjectURI /injectme.html</CODE
>
		</P
>
	    </LI
><LI
>		<P
>		    <CODE
CLASS="CONSTANT"
>InjectType</CODE
> - Add a MIME type to filter.
		    If you don't use this, the default type is <CODE
CLASS="CONSTANT"
>text/html</CODE
>.
		    This option can also have shell style glob patterns like <CODE
CLASS="CONSTANT"
>text/*</CODE
>.
		</P
>
	    </LI
></UL
>

	<DIV
CLASS="NOTE"
><BLOCKQUOTE
CLASS="NOTE"
>	    <P
><B
>Note: </B
>		You cannot use <CODE
CLASS="CONSTANT"
>InjectString</CODE
> and
		<CODE
CLASS="CONSTANT"
>InjectURI</CODE
> in the same location. Only
		use one at a time.
	    </P
>
	</BLOCKQUOTE
></DIV
>

	<DIV
CLASS="NOTE"
><BLOCKQUOTE
CLASS="NOTE"
>	    <P
><B
>Note: </B
>		You cannot use <CODE
CLASS="CONSTANT"
>InjectTag</CODE
> and
		<CODE
CLASS="CONSTANT"
>InjectAfter</CODE
> in the same location. Only
		use one at a time.
	    </P
>
	</BLOCKQUOTE
></DIV
>
    </DIV
>
    </DIV
>

    <DIV
CLASS="APPENDIX"
><HR><H1
><A
NAME="requirements"
></A
>Appendix A. Requirements</H1
>
    
    <P
>	mod_injection should compile anywhere that Apache does. You need the
	following software tools to build mod_injection.
    </P
>

    <P
></P
><P
><B
>Required Software</B
></P
><UL
><LI
>	    <P
>		The Apache web server, at least version 2.0.40.
	    </P
>
	</LI
><LI
>	    <P
>		The same C compiler you used to compile Apache.
	    </P
>
	</LI
><LI
>	    <P
>		GNU Make (since the Apache build Makefiles use GNU specific
		code).
	    </P
>
	</LI
><LI
>	    <P
>		The apxs program that comes with Apache.
	    </P
>
	</LI
></UL
>
    </DIV
>

    <DIV
CLASS="APPENDIX"
><HR><H1
><A
NAME="changelog"
></A
>Appendix B. Revision History</H1
>
    
    <DIV
CLASS="SECTION"
><HR><H2
CLASS="SECTION"
><A
NAME="cl-031"
>Version 0.3.1</A
></H2
>
	<FONT
COLOR="RED"
>February 04, 2003</FONT
>

	<P
></P
><UL
><LI
>		<P
>		    Fixed a bug where mod_injection would try to run on a response that contained no body. This would cause a core
		    dump because mod_injection would try to inspect a NULL content type header.
		</P
>
	    </LI
></UL
>
    </DIV
>
    
    <DIV
CLASS="SECTION"
><HR><H2
CLASS="SECTION"
><A
NAME="cl-030"
>Version 0.3.0</A
></H2
>
	<FONT
COLOR="RED"
>October 18, 2002</FONT
>

	<P
></P
><UL
><LI
>		<P
>		    Added InjectTag to set the name of the tag to inject after. Default is still BODY.
		</P
>
	    </LI
><LI
>		<P
>		    Added InjectAfter so you can set a string to inject after.
		</P
>
	    </LI
></UL
>
    </DIV
>
    
    <DIV
CLASS="SECTION"
><HR><H2
CLASS="SECTION"
><A
NAME="cl-020"
>Version 0.2.0</A
></H2
>
	<FONT
COLOR="RED"
>October 17, 2002</FONT
>

	<P
></P
><UL
><LI
>		<P
>		    Updated for Apache filter API change. This change requires you to be using at least version 2.0.40 of the
		    Apache web server.
		</P
>
	    </LI
><LI
>		<P
>		    Removed the InjectFile directive for security reasons. You can use the InjectURI directive to get the same
		    results.
		</P
>
	    </LI
><LI
>		<P
>		    Added some safety checks to make sure the configuration is sane.
		</P
>
	    </LI
><LI
>		<P
>		    Optimized the code, mod_injection works much faster now.
		</P
>
	    </LI
></UL
>
    </DIV
>
    
    <DIV
CLASS="SECTION"
><HR><H2
CLASS="SECTION"
><A
NAME="cl-010"
>Version 0.1.0</A
></H2
>
	<FONT
COLOR="RED"
>May 19, 2002</FONT
>

	<P
>	    First public version.
	</P
>
    </DIV
>
    </DIV
>

    <DIV
CLASS="APPENDIX"
><HR><H1
><A
NAME="cedits"
></A
>Appendix C. Credits</H1
>
    
    <P
>	mod_injection was written by 
	<A
HREF="http://pmade.org/cgi-bin/people.cgi?p=pj"
TARGET="_top"
>Peter Jones</A
>.
    </P
>

    <P
>	I also would like to say thank you to Sebastian Wolfgarten for
	including mod_injection in his book <SPAN
CLASS="QUOTE"
>"Apache Webserver 2.0"</SPAN
>.
    </P
>
    </DIV
>&#13;</DIV
></BODY
></HTML
>