psst.. this blog is on hiatus.

Apache taught me two things yesterday

There are two morals to this story.

  1. Be fancy, be careful.
  2. Quote Apache SSI directives properly.


Problem: Most of the time, my blog worked just fine. Sometimes, certain pages failed to load — I’d get a 0 byte length document. Then I’d refresh and they do load. What the heck?

In tinkering with ads, I’d created some fancy SSI directives to write my blog posts’ titles as part of an XSSI variable. Because I was doing some comparison of different advertising strategies, the variable was being created exactly 50% of the time.

Most of my blog posts’ titles are simple text — numbers and letters. But some, perhaps 5-10%, have apostrophes. I was not properly escaping the apostrophes, meaning Apache was choking on the XSSI variable declarations. For example:

<!--#set var='title' value='This title would've screwed things up' -->

If you spend too much time in front of a computer, like I do, you’ll see that there are 3 apostrophes in the “value” parameter. Not good.

So, in summary, 50% of 5-10% of the time, I created the above error. That’s a big pain in the ass to debug, especially since Apache outputs no error message to the rendered page — it simply writes errors (”premature EOF in parsed file”) to the server log, which I don’t have access to.

Why am I writing this boring post? Because I want you to find this if you’re frustrated and can’t figure out what “premature EOF in parsed file” might mean, and because I want you to learn from my incautiousness.

4 Responses to “Apache taught me two things yesterday”

  1. 1
    Luke Says:

    Oh, man! I hate when this kind of stuff happens.

    I used to work maintaining a php+Mysql app once, which was authenticating against the local LDAP. It worked great for a year, but then one day they hired Mr. O’Hara.

    You can probably see what happened here. It was fixed in 2 minutes once I found it, but of course it took us few hours to track it down, because database error messages were suppressed and no one ever bothered to log them.

  2. 2
    spudart Says:

    those apostrophes were like little daggers attacking your code.

  3. 3
    spudart Says:

    hey sucka T! why can’t i comment on the koi post? The commenting is disabled. Here’s what I want to say:
    I agree with Margie, I don’t like my fish fat. There’s something very scary about a fat fish–Especially when they are in a small acquarium.

  4. 4
    tom sherman Says:

    All right Maldre, I turned commenting on. I figured it was so inconsequential of a post that no one would bother. You proved me wrong. :P