Bug in standalone server image handling

share/html/NoAuth/images/autohandler purports to serve images directly, before
Mason gets a chance to. However, Mason loads (that is, compiles)
$m->request_comp as soon as the request object is created, so the autohandler
doesn’t actually get a chance to intervene in the case where the image file
being requested has a Mason syntax error.

The attached patch includes a test and a fix for the standalone server.
Similar solutions are probably needed for running under mod_perl or fastcgi.

hdp.

standalone-image.patch (2.48 KB)

share/html/NoAuth/images/autohandler purports to serve images directly, before
Mason gets a chance to. However, Mason loads (that is, compiles)
$m->request_comp as soon as the request object is created, so the autohandler
doesn’t actually get a chance to intervene in the case where the image file
being requested has a Mason syntax error.

The way we’ve taken to fixing this in newer code is to actually put the
images into an assets or data directory and use a dhandler to serve out
from the /images directory. It doesn’t require server changes and feels
more portable. Thoughts?

-j

The way we’ve taken to fixing this in newer code is to actually put the
images into an assets or data directory and use a dhandler to serve out
from the /images directory. It doesn’t require server changes and feels
more portable. Thoughts?

Jesse and I talked on irc about the dhandler approach and grumbled about how it
would mean changing all current image urls or moving all the files (so that the
dhandler had a chance to get in the middle).

I suggested that instead we subclass HTML::Mason::ApacheHandler and
HTML::Mason::CGIHandler to send image files without ever involving the Interp.
Attached is a patch to do so. (It includes the test files from my previous
patch.)

hdp.

rt-image.patch (4.49 KB)