httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexei Kosut <ako...@organic.com>
Subject Re: hook to an API function on fork()
Date Fri, 16 Aug 1996 20:20:01 GMT
On Fri, 16 Aug 1996, Andrew Wilson wrote:

[...]

> Uuuh, does the present API allow this level of control over the
> rate at which information is pumped out of the server?

No. But 2.0 will. Basically, you'd add a stacked discipline-like thing
that basically looked like this (I'm simplifying things greatly):

slowwrite (FILE *f, char *data) {
	fputs(f, data);
	sleep 1;
}

[...]

> Mmm, this sounds like the pre-send puppy I whined about a while
> back, I needed it then to remove code from the fixups section of
> mod_cern_meta, and wanted a 'called once per request' hook to come
> into play just prior to the real data getting sent, so's I could
> influence the outgoing header set.

That's what fixups are for, IMO.

> I extended the current API to add a hook in send_http_headers which
> was keyed off a 'magic type' that get shoehorned into the module's
> published handler structure:
> 
>     handler_rec mod_cern_meta_extended_api_handlers[] = {
>     { "BEFORE_SEND_HTTP_HEADER", add_cern_meta_data },
>     { NULL }
>     };
> 
>     [don't get confused by this, I'm overloading the semantics of
>     handler_rec, specifically the type 'BEFORE_SEND_HTTP_HEADER'
>     doesn't have anything to do with the mime type of the resource
>     being requested, and using this technique the addition is
>     transparent to the 'normal' operation of the server.]

This is a Bad Idea.

> My main problem was finding a way to do this that din't demand a
> new slot to be set up in the 'module' structure, which would have
> meant for a nasty redesign each time someone else changed the API.
> And in general I regarded a hardcoded response to extending API to
> be inadequate.

Nothing wrong with adding slots. As I said, I think we'll need to do it
for 2.0 anyway. And as I've said before, it can be made source-compatible
with existing modules. Even if it wasn't, they just need to add a couple
NULLs to their module_rec structure and it'll work fine. But it can be
done. (I explained exactly how in a message a few weeks ago).

-- Alexei Kosut <akosut@organic.com>            The Apache HTTP Server 
   http://www.nueva.pvt.k12.ca.us/~akosut/      http://www.apache.org/


Mime
View raw message