Forum

Compile-time plug-in

Peter
13 September 2016, 00:17
Could you provide a hook-point, or hook-points, for having Hiawatha call application logic? This would be for countless uses, like custom scripting languages, translation engines, high-performance embedded app-servers, etc. The hook would be like Fast-CGI, but instead dispatch to a procedure in a file, such as "application-hook.c"

The syntax to call the application-hook could be something like:
VirtualHost {
...
UseApplicationHook = EmbeddedApp
}

which would send the application-hook-name to the ApplicationHook() call, along with the request.


or
VirtualHost {
...
UseApplicationHookAfter = Translate1
}

which would send the application-hook-name to the ApplicationHook() call, with the returned page contents.
Hugo Leisink
13 September 2016, 07:13
I do not fully understand what you want, but it already sounds a bit like something that does not belong in a webserver. A webserver can start a CGI application upon request by a client, but after that it is up to the CGI application to do its thing.

What problem do you try to solve with this?
Peter
13 September 2016, 15:47
Reduced latency through tighter integration.

Basically, what I'm requesting are compile-time hooks. That way, there is a clean, and generally forward-compatible compile-time mechanism, for everyone to add the countless extensions that benefit their vertical needs but don't belong in the core release. Anyone who needs the performance benefits "mod_php", "mod_ruby", or a connection pooler provides, or has a need to integrate Lua, or MySQL, or the Firebird DB engine, or LDAP (cringe), they can. And with little impact to Hiawatha's core.

In some ways, you could think of it as libHiawatha, but Hiawatha would be the controlling process.

If the primary reason not-to provide-source-code-hooks is to dissuade insecure code from being compiled-in with Hiawatha, it might be worth considering focusing on making the source-code API more secure. In which case, instead of exposing Hiawatha's internals to third-party developer source, and allowing it to run as user hiawatha, instead, prior to the first call to ApplicationHook(), Hiawatha could perform a a one-time fork, and switch that fork to a specified user, (default nobody,) and send/receive data with ApplicationHook() via a shared memory block.
Hugo Leisink
13 September 2016, 16:05
Sounds to me a FastCGI application just does that. Start your FastCGI application and let Hiawatha connect to it via a Unix socket. It should be fast enough.
This topic has been closed.