[Mod_gzip] Cleanup and Init in Mod_gzip
Tejas Sumant
mod_gzip@lists.over.net
Wed, 17 Mar 2004 10:55:53 +0530
This is a multi-part message in MIME format.
------=_NextPart_000_0027_01C40C0E.6AD92E30
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi Michael,
We have our own compression card. We want to bypass software
compression done using mod_gzip. We are mapping device memory
to module memory and this I want to do when module get loaded.
Simillarly unmapping is desired at unloading time.
So I want to add some code in mod_gzip.
I checked all hooks available with Apache 1.3.
But none I found useful for my purpose.
There is module_child_init hook, but I want a hook called at
load time and not when a child is created.
Second one is module_child_exit. The is same as child_init.
I want a hook at the time of exit.
Regards,
Tejas
=20
----- Original Message -----=20
From: Michael.Schroepl@telekurs.de=20
To: mod_gzip@lists.over.net=20
Cc: tejas@indranetwroks.com
Sent: Tuesday, March 16, 2004 9:19 PM
Subject: Re: [Mod_gzip] Cleanup and Init in Mod_gzip
Hi Tejas,=20
> Q. 1) I want to call my cleanup function when then module gets =
unloaded=20
> or at resrtart or shutdown of Apache server.=20
> Please can anyone tell me, where should I call my cleanup function =
from?=20
inserting your code into a third-party module seems an=20
awkward way of handling whatever problem you have,=20
instead of just implementing your own module.=20
So I would rather suggest to think about a different way=20
of doing whatever you want to do, as it might be much=20
easier then.=20
Which kind of "cleanup" do you have in mind so that you=20
want to bundle it to the availability of mod_gzip?=20
If it were something that would improve the operation=20
of mod_gzip itself you might as well formulate a feature=20
request; and if not, inserting the code into mod_gzip=20
might be a bad idea as you could possibly have to=20
maintain your modification in all future versions.=20
I am not aware of any way to unload a module except=20
for restarting Apache, so if you want to handle this case=20
(whichever hook the Apache API might provide for this=20
purpose) then you would likely have your solution already,=20
and it would be completely outside the mod_gzip code.=20
> Q. 2) mod_gzip_init function gets called twice when server starts.=20
> I want to call my init funtion from within mod_gzip_init.=20
> As mod_gzip_init is getting called twice my init function is=20
> getting called twice, which is undesirable.=20
> I declared a static variable with initial value 0 and incremented=20
> for each call. But this technique also failed. Please can anyone=20
> tell me solution.=20
I don't know too much about the Shambhala API=20
(http://httpd.apache.org/dev/API.html)=20
but I would guess that the "init" function might receive=20
parameter values from where it is able to find out which=20
one of these two invocations is taking place at the moment.=20
So this is where I would try to look at first.=20
I don't think your implementation should modify the=20
mod_gzip code - you are about to create an unnecessary=20
dependence here.=20
Perhaps you should discuss your problem with the Apache=20
Group so that they could show you the Apache hook most=20
appropriately for your purpose.=20
Regards, Michael
------=_NextPart_000_0027_01C40C0E.6AD92E30
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1106" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi Michael,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> We have our own compression card. =
We want to=20
bypass software</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> compression done using mod_gzip. =
We are=20
mapping device memory</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> to module memory and this I want =
to do when=20
module get loaded.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> Simillarly unmapping is desired =
at unloading=20
time.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> So I want to add some code =
in =20
mod_gzip.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> I checked all hooks available =
with Apache=20
1.3.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> But none I found useful for =
my=20
purpose.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> There is module_child_init hook, =
but I want=20
a hook called at</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> load time and not when a child =
is=20
created.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> Second one is module_child_exit. =
The is same=20
as child_init.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> I want a hook at the time of=20
exit.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> Regards,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> Tejas</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> </FONT></DIV>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style=3D"FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV=20
style=3D"BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: =
black"><B>From:</B>=20
<A title=3DMichael.Schroepl@telekurs.de=20
=
href=3D"mailto:Michael.Schroepl@telekurs.de">Michael.Schroepl@telekurs.de=
</A>=20
</DIV>
<DIV style=3D"FONT: 10pt arial"><B>To:</B> <A =
title=3Dmod_gzip@lists.over.net=20
href=3D"mailto:mod_gzip@lists.over.net">mod_gzip@lists.over.net</A> =
</DIV>
<DIV style=3D"FONT: 10pt arial"><B>Cc:</B> <A=20
=
href=3D"mailto:tejas@indranetwroks.com">tejas@indranetwroks.com</A></DIV>=
<DIV style=3D"FONT: 10pt arial"><B>Sent:</B> Tuesday, March 16, 2004 =
9:19=20
PM</DIV>
<DIV style=3D"FONT: 10pt arial"><B>Subject:</B> Re: [Mod_gzip] Cleanup =
and Init=20
in Mod_gzip</DIV>
<DIV><FONT face=3DArial size=3D2></FONT><FONT face=3DArial=20
size=3D2></FONT><BR></DIV><BR><FONT face=3Dsans-serif color=3Dred =
size=3D2><B>Hi=20
Tejas,</B></FONT> <BR><BR><BR><FONT face=3Dsans-serif color=3Dred =
size=3D2><B>>=20
</B></FONT><FONT face=3DArial size=3D2>Q. 1) I want to call my cleanup =
function=20
when then module gets</FONT><FONT face=3Dsans-serif color=3Dred =
size=3D2><B>=20
</B></FONT><FONT face=3DArial size=3D2>unloaded</FONT> <BR><FONT =
face=3Dsans-serif=20
color=3Dred size=3D2><B>> </B></FONT><FONT face=3DArial size=3D2>or =
at resrtart or=20
shutdown of Apache server.</FONT> <BR><FONT face=3Dsans-serif =
color=3Dred=20
size=3D2><B>> </B></FONT><FONT face=3DArial size=3D2>Please can =
anyone tell me,=20
where should I call my cleanup function</FONT><FONT face=3Dsans-serif =
color=3Dred=20
size=3D2><B> </B></FONT><FONT face=3DArial size=3D2>from?</FONT> =
<BR><BR><FONT=20
face=3Dsans-serif color=3Dred size=3D2><B>inserting your code into a =
third-party=20
module seems an</B></FONT> <BR><FONT face=3Dsans-serif =
color=3Dred=20
size=3D2><B>awkward way of handling whatever problem you =
have,</B></FONT>=20
<BR><FONT face=3Dsans-serif color=3Dred size=3D2><B>instead of just =
implementing=20
your own module.</B></FONT> <BR><BR><FONT face=3Dsans-serif =
color=3Dred=20
size=3D2><B>So I would rather suggest to think about a different =
way</B></FONT>=20
<BR><FONT face=3Dsans-serif color=3Dred size=3D2><B>of doing whatever =
you want to=20
do, as it might be much</B></FONT> <BR><FONT face=3Dsans-serif =
color=3Dred=20
size=3D2><B>easier then.</B></FONT> <BR><BR><FONT face=3Dsans-serif =
color=3Dred=20
size=3D2><B>Which kind of "cleanup" do you have in mind so that =
you</B></FONT>=20
<BR><FONT face=3Dsans-serif color=3Dred size=3D2><B>want to bundle it =
to the=20
availability of mod_gzip?</B></FONT> <BR><FONT face=3Dsans-serif =
color=3Dred=20
size=3D2><B>If it were something that would improve the =
operation</B></FONT>=20
<BR><FONT face=3Dsans-serif color=3Dred size=3D2><B>of mod_gzip itself =
you might as=20
well formulate a feature</B></FONT> <BR><FONT face=3Dsans-serif =
color=3Dred=20
size=3D2><B>request; and if not, inserting the code into =
mod_gzip</B></FONT>=20
<BR><FONT face=3Dsans-serif color=3Dred size=3D2><B>might be a bad =
idea as you could=20
possibly have to</B></FONT> <BR><FONT face=3Dsans-serif color=3Dred=20
size=3D2><B>maintain your modification in all future =
versions.</B></FONT>=20
<BR><BR><FONT face=3Dsans-serif color=3Dred size=3D2><B>I am not aware =
of any way to=20
unload a module except</B></FONT> <BR><FONT face=3Dsans-serif =
color=3Dred=20
size=3D2><B>for restarting Apache, so if you want to handle this =
case</B></FONT>=20
<BR><FONT face=3Dsans-serif color=3Dred size=3D2><B>(whichever hook =
the Apache API=20
might provide for this</B></FONT> <BR><FONT face=3Dsans-serif =
color=3Dred=20
size=3D2><B>purpose) then you would likely have your solution=20
already,</B></FONT> <BR><FONT face=3Dsans-serif color=3Dred =
size=3D2><B>and it would=20
be completely outside the mod_gzip code.</B></FONT> <BR><BR><FONT=20
face=3Dsans-serif color=3Dred size=3D2><B>> </B></FONT><FONT =
face=3DArial size=3D2>Q.=20
2) mod_gzip_init function gets called twice when server starts.</FONT> =
<BR><FONT face=3Dsans-serif color=3Dred size=3D2><B>> =
</B></FONT><FONT face=3DArial=20
size=3D2>I want to call my init funtion from within =
mod_gzip_init.</FONT>=20
<BR><FONT face=3Dsans-serif color=3Dred size=3D2><B>> =
</B></FONT><FONT face=3DArial=20
size=3D2>As mod_gzip_init is getting called twice my init function is=20
</FONT><BR><FONT face=3Dsans-serif color=3Dred size=3D2><B>> =
</B></FONT><FONT=20
face=3DArial size=3D2>getting called twice, which is =
undesirable.</FONT> <BR><FONT=20
face=3Dsans-serif color=3Dred size=3D2><B>> </B></FONT><FONT =
face=3DArial size=3D2>I=20
declared a static variable with initial value 0 and incremented</FONT> =
<BR><FONT face=3Dsans-serif color=3Dred size=3D2><B>> =
</B></FONT><FONT face=3DArial=20
size=3D2>for each call. But this technique also failed. Please can =
anyone</FONT>=20
<BR><FONT face=3Dsans-serif color=3Dred size=3D2><B>> =
</B></FONT><FONT face=3DArial=20
size=3D2>tell me solution.</FONT> <BR><BR><FONT face=3Dsans-serif =
color=3Dred=20
size=3D2><B>I don't know too much about the Shambhala API</B></FONT> =
<BR><FONT=20
face=3Dsans-serif color=3Dred size=3D2><B> =20
(http://httpd.apache.org/dev/API.html)</B></FONT> <BR><FONT =
face=3Dsans-serif=20
color=3Dred size=3D2><B>but I would guess that the "init" function =
might=20
receive</B></FONT> <BR><FONT face=3Dsans-serif color=3Dred =
size=3D2><B>parameter=20
values from where it is able to find out which</B></FONT> <BR><FONT=20
face=3Dsans-serif color=3Dred size=3D2><B>one of these two invocations =
is taking=20
place at the moment.</B></FONT> <BR><FONT face=3Dsans-serif =
color=3Dred=20
size=3D2><B>So this is where I would try to look at first.</B></FONT>=20
<BR><BR><FONT face=3Dsans-serif color=3Dred size=3D2><B>I don't think =
your=20
implementation should modify the</B></FONT> <BR><FONT =
face=3Dsans-serif=20
color=3Dred size=3D2><B>mod_gzip code - you are about to create an=20
unnecessary</B></FONT> <BR><FONT face=3Dsans-serif color=3Dred=20
size=3D2><B>dependence here.</B></FONT> <BR><FONT face=3Dsans-serif =
color=3Dred=20
size=3D2><B>Perhaps you should discuss your problem with the =
Apache</B></FONT>=20
<BR><FONT face=3Dsans-serif color=3Dred size=3D2><B>Group so that they =
could show=20
you the Apache hook most</B></FONT> <BR><FONT face=3Dsans-serif =
color=3Dred=20
size=3D2><B>appropriately for your purpose.</B></FONT> <BR><FONT =
face=3Dsans-serif=20
color=3Dred size=3D2><B>Regards, =
Michael</B></FONT></BLOCKQUOTE></BODY></HTML>
------=_NextPart_000_0027_01C40C0E.6AD92E30--