By Chris at June 13th, 2004 22:56:00

Third post for the day! So what else am I going to do with my time when I'm sick?

Apache 2 is installed and running. You can tell that because that's the server used to display this site. The reason for the swap from the 1.3 tree? Well, the filter feature is what I wanted. The 1.3 tree did everything that I need, except that I wanted to parse the output of a cgi script using something like, say, mod_include. Without this, when cgi scripts output the standard templates for the site, all the SSI content in those templates doesn't get processed. That means that you'll end up with broken bits in the template.

One way around this is to write a perl module (to be used in all your cgi scipts) that will read the file and process the SSI's for you. This is obviously a bad idea, because you have to reproduce all the mod_include functionality yourself, without the benefit of Apache's built in security checking, alias expansion, etc... Not a good option.

Or, you could have the templates actually *be* a cgi script that generates the output (maybe by way of some modules that can be included or executed from your other cgi scripts). This would work nicely for a low volume site (like mine), but for a high volume site it would be a server killer. Given my experience as a Systems Admin, a non-site killer method is better.

The immediate compromise on the above would be to only generate the content periodically, so that the content doesn't have to be parsed. The immediate problem with that is that you lose true dynamic content in your templates: everything is pre-generated. I don't like that idea either, because I lose flexability on what I can put on my page.

Alternatively, you could wrap the cgi output with other apache generated requests that will handle the SSI. The only real way I could achieve this was to use an alternative .shtml file which then has an "includes virtual" directive for the script being called. You can even do some funky stuff like this in your config:

RewriteEngine on RewriteCond %{REQUEST_FILENAME} \.cgi$ RewriteCond %{REQUEST_FILENAME}\.shtml -f RewriteRule ^(.*)$ $1.shtml

That will automatically try to detect a url with the same name + .shtml on the end, and use that for the request. Inside that file is the include virtual directive for the original cgi script. This method works for cgi scripts when then get method is being used, but mod_include will reject that when the post method is used.

I toyed with some other things, amongst which was trying to add multiple handlers for filetypes, but nothing really worked just right. What I wanted was definately to be able to pass the output of one handler (or filter) through another. Apache 1.3 doesn't allow stacked filters. If you want to pass something through the two modules, then what you actually have to do was to write a new module which contained the functionality of *both* modules, and use that instead of the two original ones. This isn't hard, because the code is already written, but it would be nice to not have to do it.

Luckily, Apache 2 allows stacked output filters. So with one line in the config:

AddOutputFilter INCLUDES .shtml .cgi .pl

everything works the way I want it. So now when you visit cgi generated pages, you see everything that you're supposed to see.

By Chris at June 10th, 2003 15:20:00

yay!

By Chris at March 13th, 2003 18:31:00

So I decide to join the bandwagon and start a Web Log. I get the feeling that this can be an outlet for people to vent their frustration, share their thoughts, or just muse. Whatever. For me, I'll just wait and see how it turns out.

I recall that I used to keep a personal "diary" type thing after I finished highschool, and kept it up for nearly 6 months. This habit grew out of a similar "communal" diary that a group of my friends and I kept together. We'd leave notes to each other in them, general statements about life itself, rants, etc. That tapered off after uni started (for some of us anyway) because we weren't able to keep in as close contact after that. I decided to keep my own diary that I used to keep personal notes in, but mainly to try to lay out my thoughts at the time, analyse them, and try to wring from them some sort of answer or reason for my thoughts. Therapy.

During some traumatic events later that year (first year of Uni), the habit ceased to be. I've always intended to return to the habit. I once actually started it again, lasted one entry (long one, mind you), and then gave it up. I intend to continue this blog. I think that initially this will be a cathartic experience, however I hope it evolves into something of a more philosophical nature.