You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modules-dev@httpd.apache.org by Oğuzhan TOPGÜL <og...@gmail.com> on 2011/12/04 22:47:37 UTC

Inject html into response body

Hi,
I' ve search for all the archieve but i couln't find the answer, may be i
missed up, don't know.
I'm trying to write an apache module and i want to inject some html code
into resonses.
It might be in body, header or footer. The only thing that i want to
implemet is inserting an url or a text into all response bodies without
damaging the original page that is serving.
Is there any basic way of doing that?

thanks

Oguzhan

Re: Inject html into response body

Posted by Ray Morris <su...@bettercgi.com>.
> purpose. At first i think this is not that much hard to add just a
> url or just a text at the end of the page as a footer. But now, i
> think this is not that much easy to apply.

Have a look at mod_footer. However you're right, it's not as easy as
one might hope.

> > > Well, why don't you just write an output filter that does this? I
> > > think Nick's book will provide all the information you need.

Be aware that output filters are harder to get RIGHT than they appear 
from the book and other similar sources. All of the other types of 
modules other than filters are farily straightforward to learn from 
the book or well known examples, in my opinion. The common examples 
for filters show how to cause yourself problems, though. Examples in 
the book consume memory proportional to the size of the resource, for 
example, thereby creating a denial of service that could be triggered
accidentally or on purpose. Other examples mess up range requests and 
other responses that aren't trivial. So I agree, it's "not that much
easy". It's easy to write bad filter, difficult to write a proper one.
(Too difficult for me, perhaps.)
-- 
Ray Morris
support@bettercgi.com

Strongbox - The next generation in site security:
http://www.bettercgi.com/strongbox/

Throttlebox - Intelligent Bandwidth Control
http://www.bettercgi.com/throttlebox/

Strongbox / Throttlebox affiliate program:
http://www.bettercgi.com/affiliates/user/register.php




On Mon, 5 Dec 2011 09:23:40 +0200
Oğuzhan TOPGÜL <og...@gmail.com> wrote:

> No, there is no particular web site whoose HTML is tailored for this
> purpose. At first i think this is not that much hard to add just a
> url or just a text at the end of the page as a footer. But now, i
> think this is not that much easy to apply.
> regards
> Oguzhan
> On Mon, Dec 5, 2011 at 12:44 AM, Joshua Marantz <jm...@google.com>
> wrote:
> 
> > What's your thinking on how you are going to parse the HTML to
> > inject the code?  Do you need to parse arbitrary HTML from any
> > website or is this filter targeted at a particular site whose HTML
> > is tailored for this purpose?
> >
> > -Josh
> >
> > On Sun, Dec 4, 2011 at 5:15 PM, <rm...@tuxteam.de> wrote:
> >
> > > On Sun, Dec 04, 2011 at 11:47:37PM +0200, O??uzhan TOPG?L wrote:
> > > > Hi,
> > > > I' ve search for all the archieve but i couln't find the
> > > > answer, may
> > be i
> > > > missed up, don't know.
> > > > I'm trying to write an apache module and i want to inject some
> > > > html
> > code
> > > > into resonses.
> > > > It might be in body, header or footer. The only thing that i
> > > > want to implemet is inserting an url or a text into all
> > > > response bodies without damaging the original page that is
> > > > serving. Is there any basic way of doing that?
> > >
> > > Well, why don't you just write an output filter that does this? I
> > > think Nick's book will provide all the information you need.
> > > Or have a look at mod_include in apache's source code.
> > >
> > >  Cheers, Ralf Mattes
> > > > thanks
> > > >
> > > > Oguzhan
> > >
> >


Re: Inject html into response body

Posted by Oğuzhan TOPGÜL <og...@gmail.com>.
No, there is no particular web site whoose HTML is tailored for this
purpose. At first i think this is not that much hard to add just a url or
just a text at the end of the page as a footer. But now, i think this is
not that much easy to apply.
regards
Oguzhan
On Mon, Dec 5, 2011 at 12:44 AM, Joshua Marantz <jm...@google.com> wrote:

> What's your thinking on how you are going to parse the HTML to inject the
> code?  Do you need to parse arbitrary HTML from any website or is this
> filter targeted at a particular site whose HTML is tailored for this
> purpose?
>
> -Josh
>
> On Sun, Dec 4, 2011 at 5:15 PM, <rm...@tuxteam.de> wrote:
>
> > On Sun, Dec 04, 2011 at 11:47:37PM +0200, O??uzhan TOPG?L wrote:
> > > Hi,
> > > I' ve search for all the archieve but i couln't find the answer, may
> be i
> > > missed up, don't know.
> > > I'm trying to write an apache module and i want to inject some html
> code
> > > into resonses.
> > > It might be in body, header or footer. The only thing that i want to
> > > implemet is inserting an url or a text into all response bodies without
> > > damaging the original page that is serving.
> > > Is there any basic way of doing that?
> >
> > Well, why don't you just write an output filter that does this? I think
> > Nick's book will provide all the information you need.
> > Or have a look at mod_include in apache's source code.
> >
> >  Cheers, Ralf Mattes
> > > thanks
> > >
> > > Oguzhan
> >
>

Re: Inject html into response body

Posted by Joshua Marantz <jm...@google.com>.
What's your thinking on how you are going to parse the HTML to inject the
code?  Do you need to parse arbitrary HTML from any website or is this
filter targeted at a particular site whose HTML is tailored for this
purpose?

-Josh

On Sun, Dec 4, 2011 at 5:15 PM, <rm...@tuxteam.de> wrote:

> On Sun, Dec 04, 2011 at 11:47:37PM +0200, O??uzhan TOPG?L wrote:
> > Hi,
> > I' ve search for all the archieve but i couln't find the answer, may be i
> > missed up, don't know.
> > I'm trying to write an apache module and i want to inject some html code
> > into resonses.
> > It might be in body, header or footer. The only thing that i want to
> > implemet is inserting an url or a text into all response bodies without
> > damaging the original page that is serving.
> > Is there any basic way of doing that?
>
> Well, why don't you just write an output filter that does this? I think
> Nick's book will provide all the information you need.
> Or have a look at mod_include in apache's source code.
>
>  Cheers, Ralf Mattes
> > thanks
> >
> > Oguzhan
>

Re: Inject html into response body

Posted by rm...@tuxteam.de.
On Sun, Dec 04, 2011 at 11:47:37PM +0200, O??uzhan TOPG?L wrote:
> Hi,
> I' ve search for all the archieve but i couln't find the answer, may be i
> missed up, don't know.
> I'm trying to write an apache module and i want to inject some html code
> into resonses.
> It might be in body, header or footer. The only thing that i want to
> implemet is inserting an url or a text into all response bodies without
> damaging the original page that is serving.
> Is there any basic way of doing that?

Well, why don't you just write an output filter that does this? I think
Nick's book will provide all the information you need.
Or have a look at mod_include in apache's source code.

 Cheers, Ralf Mattes
> thanks
> 
> Oguzhan