[Mod_gzip] Cleanup and Init in Mod_gzip
mod_gzip@lists.over.net
mod_gzip@lists.over.net
Tue, 16 Mar 2004 16:49:13 +0100
Dies ist eine mehrteilige Nachricht im MIME-Format.
--=_alternative 0056E85EC1256E59_=
Content-Type: text/plain; charset="US-ASCII"
Hi Tejas,
> Q. 1) I want to call my cleanup function when then module gets unloaded
> or at resrtart or shutdown of Apache server.
> Please can anyone tell me, where should I call my cleanup function from?
inserting your code into a third-party module seems an
awkward way of handling whatever problem you have,
instead of just implementing your own module.
So I would rather suggest to think about a different way
of doing whatever you want to do, as it might be much
easier then.
Which kind of "cleanup" do you have in mind so that you
want to bundle it to the availability of mod_gzip?
If it were something that would improve the operation
of mod_gzip itself you might as well formulate a feature
request; and if not, inserting the code into mod_gzip
might be a bad idea as you could possibly have to
maintain your modification in all future versions.
I am not aware of any way to unload a module except
for restarting Apache, so if you want to handle this case
(whichever hook the Apache API might provide for this
purpose) then you would likely have your solution already,
and it would be completely outside the mod_gzip code.
> Q. 2) mod_gzip_init function gets called twice when server starts.
> I want to call my init funtion from within mod_gzip_init.
> As mod_gzip_init is getting called twice my init function is
> getting called twice, which is undesirable.
> I declared a static variable with initial value 0 and incremented
> for each call. But this technique also failed. Please can anyone
> tell me solution.
I don't know too much about the Shambhala API
(http://httpd.apache.org/dev/API.html)
but I would guess that the "init" function might receive
parameter values from where it is able to find out which
one of these two invocations is taking place at the moment.
So this is where I would try to look at first.
I don't think your implementation should modify the
mod_gzip code - you are about to create an unnecessary
dependence here.
Perhaps you should discuss your problem with the Apache
Group so that they could show you the Apache hook most
appropriately for your purpose.
Regards, Michael
--=_alternative 0056E85EC1256E59_=
Content-Type: text/html; charset="US-ASCII"
<br><font size=2 color=red face="sans-serif"><b>Hi Tejas,</b></font>
<br>
<br>
<br><font size=2 color=red face="sans-serif"><b>> </b></font><font size=2 face="Arial">Q.
1) I want to call my cleanup function when then module gets</font><font size=2 color=red face="sans-serif"><b>
</b></font><font size=2 face="Arial">unloaded</font>
<br><font size=2 color=red face="sans-serif"><b>> </b></font><font size=2 face="Arial">or
at resrtart or shutdown of Apache server.</font>
<br><font size=2 color=red face="sans-serif"><b>> </b></font><font size=2 face="Arial">Please
can anyone tell me, where should I call my cleanup function</font><font size=2 color=red face="sans-serif"><b>
</b></font><font size=2 face="Arial">from?</font>
<br>
<br><font size=2 color=red face="sans-serif"><b>inserting your code into
a third-party module seems an</b></font>
<br><font size=2 color=red face="sans-serif"><b>awkward way of handling
whatever problem you have,</b></font>
<br><font size=2 color=red face="sans-serif"><b>instead of just implementing
your own module.</b></font>
<br>
<br><font size=2 color=red face="sans-serif"><b>So I would rather suggest
to think about a different way</b></font>
<br><font size=2 color=red face="sans-serif"><b>of doing whatever you want
to do, as it might be much</b></font>
<br><font size=2 color=red face="sans-serif"><b>easier then.</b></font>
<br>
<br><font size=2 color=red face="sans-serif"><b>Which kind of "cleanup"
do you have in mind so that you</b></font>
<br><font size=2 color=red face="sans-serif"><b>want to bundle it to the
availability of mod_gzip?</b></font>
<br><font size=2 color=red face="sans-serif"><b>If it were something that
would improve the operation</b></font>
<br><font size=2 color=red face="sans-serif"><b>of mod_gzip itself you
might as well formulate a feature</b></font>
<br><font size=2 color=red face="sans-serif"><b>request; and if not, inserting
the code into mod_gzip</b></font>
<br><font size=2 color=red face="sans-serif"><b>might be a bad idea as
you could possibly have to</b></font>
<br><font size=2 color=red face="sans-serif"><b>maintain your modification
in all future versions.</b></font>
<br>
<br><font size=2 color=red face="sans-serif"><b>I am not aware of any way
to unload a module except</b></font>
<br><font size=2 color=red face="sans-serif"><b>for restarting Apache,
so if you want to handle this case</b></font>
<br><font size=2 color=red face="sans-serif"><b>(whichever hook the Apache
API might provide for this</b></font>
<br><font size=2 color=red face="sans-serif"><b>purpose) then you would
likely have your solution already,</b></font>
<br><font size=2 color=red face="sans-serif"><b>and it would be completely
outside the mod_gzip code.</b></font>
<br>
<br><font size=2 color=red face="sans-serif"><b>> </b></font><font size=2 face="Arial">Q.
2) mod_gzip_init function gets called twice when server starts.</font>
<br><font size=2 color=red face="sans-serif"><b>> </b></font><font size=2 face="Arial">I
want to call my init funtion from within mod_gzip_init.</font>
<br><font size=2 color=red face="sans-serif"><b>> </b></font><font size=2 face="Arial">As
mod_gzip_init is getting called twice my init function is </font>
<br><font size=2 color=red face="sans-serif"><b>> </b></font><font size=2 face="Arial">getting
called twice, which is undesirable.</font>
<br><font size=2 color=red face="sans-serif"><b>> </b></font><font size=2 face="Arial">I
declared a static variable with initial value 0 and incremented</font>
<br><font size=2 color=red face="sans-serif"><b>> </b></font><font size=2 face="Arial">for
each call. But this technique also failed. Please can anyone</font>
<br><font size=2 color=red face="sans-serif"><b>> </b></font><font size=2 face="Arial">tell
me solution.</font>
<br>
<br><font size=2 color=red face="sans-serif"><b>I don't know too much about
the Shambhala API</b></font>
<br><font size=2 color=red face="sans-serif"><b>
(http://httpd.apache.org/dev/API.html)</b></font>
<br><font size=2 color=red face="sans-serif"><b>but I would guess that
the "init" function might receive</b></font>
<br><font size=2 color=red face="sans-serif"><b>parameter values from where
it is able to find out which</b></font>
<br><font size=2 color=red face="sans-serif"><b>one of these two invocations
is taking place at the moment.</b></font>
<br><font size=2 color=red face="sans-serif"><b>So this is where I would
try to look at first.</b></font>
<br>
<br><font size=2 color=red face="sans-serif"><b>I don't think your implementation
should modify the</b></font>
<br><font size=2 color=red face="sans-serif"><b>mod_gzip code - you are
about to create an unnecessary</b></font>
<br><font size=2 color=red face="sans-serif"><b>dependence here.</b></font>
<br><font size=2 color=red face="sans-serif"><b>Perhaps you should discuss
your problem with the Apache</b></font>
<br><font size=2 color=red face="sans-serif"><b>Group so that they could
show you the Apache hook most</b></font>
<br><font size=2 color=red face="sans-serif"><b>appropriately for your
purpose.</b></font>
<br><font size=2 color=red face="sans-serif"><b>Regards, Michael</b></font>
--=_alternative 0056E85EC1256E59_=--