So I wanted to make my server as updatable as possible. An obvious place to start with this was to allow the user to add the ability to deal with new scripting engines and media types. The solution just hit me and seems painfully obvious after so much thinking about it. Here's my idea:
Create programs that, when run for the first time, add themselves to a 'registry' in the server, and associate themselves with a certain file type. When this file type is encountered in a request (PHP files, for example), the file is called with the request resource as a parameter, and the HTTP headers, CGI content, etc... Each program will be different, but will organize the data in such a way that it can call the correct scripting program with the right data, and then pipe the output to a certain file (I would also pass a unique identifier to the program). This file would then be picked up by the server (parent program), and sent back to the user. As new scripting engines come out or are requested, new programs of this sort could easily be created and made available.
I have a couple of questions, and would also like to open it up for comments. First, I know an advntage of scripting engines like PHP is that part of the content can be sent on it's way while latter parts of the output are still being processed. This wouldn't work with my method, now would it? Any ideas? I also can't think of how to have the parent program know when the file is done.
Thanks for reading, and perhaps even writing.