httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew <and...@aaaaaaaa.demon.co.uk>
Subject Re: letting modules specify startup code
Date Mon, 19 Feb 1996 14:59:30 GMT
Brian:
> It doesn't *appear* that the Apache API allows for modules to
> specify some chunk of code to be performed at startup, so before we go off
> hacking this into http_main.c or wherever, does anyone have some good ideas
> about generalizing this?  Is this a whack model?

Nope it makes sense.  The API's ready for a rethink I believe, case
in point being the problems I had with mod_expires.c.  ME calls
table_add() to write the Expires: header into the outgoing header
list and does this each time the fixup hook is called.  Unfortunately
the semantics of fixup aren't quite in tune with the application.

Say you had:

	DirectoryIndex index.html index.htm

and called the URL http://foo.com/ then Apache tries to fill in
the blanks and will attempt to map to http://foo.com/index.html,
http://foo.com/index.htm in sequence till it gets a match.  Each
time fixups() will be called duplicating the work for the Expires:
header calculations [ok I've optomised it a bit, the point is it's
still getting called].

Instead of fixups I'm looking for pre-send() which has the semantics:

	"pre-send()  apache knows which file it's going to send,
	so call this function in the understanding that it only
	ever gets called once per satisfied access AND it's the
	last thing to be called before data starts shipping out of
	the server"

so I can use that to stat the file and work out the expires header
just once.

Ok, a different subject.  Modules need to be more aware of the
environment they're in.  At the very least there should be hooks
to call when a module is initialised, restarted, shutdown, either
independantly or as a result of the server changing state:

	"start() called once at server startup"

		eg: open connections to Oracle, initialise local cache...

	"restart() called following server restart (-HUP)"

		eg: check connections to oracle, clean local cache,

	"stop() called on server shutdown (-TERM)
		
		eg: graceful close, write stats to log files, mail root
		wave bye to Oracle maybe Oracle is going down and needs 
		to signal goodbye...

Have you seen David Hankins mod_dld_elf.c stuff which slightly
extends the idea of a module hot-swap.  Ie reconfiguring, or even
removing/installing a module without killing the server (and other
systems which may depend on it, like Oracle for instance)?

> 	Brian

Mime
View raw message