I’m writing my code as an extension to make it easier to load on my
customer’s development, test and production servers. I’m trying to
add an ajax spinner, so I added it in my source directory
html/NoAuth/images/foo/ajax-spinner.gif, and it gets installed in
/opt/rt4/local/plugins/foo/html/NoAuth/images/foo/ajax-spinner.gif,
however when I try to load that file, I get the problem where Mason is
trying to interpret the file as source. Now I just read something
about that yesterday or today, either here on the list or on IRC, but
I can’t find the actual message. But based on what I remembered, I
copied the autohandler from /opt/rt4/share/html/NoAuth/images/ into my
image directory, hoping that would make the gif load as a gif instead
of as a Mason file. But it doesn’t seem to be happening. I even put
a $RT::Logger->debug line in the autohandler and it doesn’t seem to be
executed.
I’m running the server in stand-alone mode, built using
./configure --enable-devel-mode --with-my-user-group --with-db-type=Pg
–with-web-handler=standalone,fastcgi
and started up with
/opt/rt4/sbin/rt-server --server Standalone --port 8080
http://www.linkedin.com/in/paultomblin
http://careers.stackoverflow.com/ptomblin
The mystery deepens. I put some debugging into the autohandler in
/opt/rt4/share/html/NoAuth/images/autohandler:
<%INIT>
This autohandler will spit out RT’s images if the user hasn’t
properly configured their webserver to stop RT from passing
images through the mason handler.
my $file = $m->base_comp->source_file;
my $relfile = $m->base_comp->path;
$RT::Logger->debug(“autohandler file = $file, relfile = $relfile”);
RT::Interface::Web->SendStaticFile( File => $file, RelativeFile => $relfile );
</%INIT>
And when I try to load
http://localhost:8080/NoAuth/images/favicon.png, I see the following
come out in my log:
[Tue Jun 5 01:24:59 2012] [debug]: autohandler file =
/opt/rt4/share/html/NoAuth/images/favicon.png, relfile =
/NoAuth/images/favicon.png
(/opt/rt4/share/html/NoAuth/images/autohandler:7)
and the image shows up correctly. But if I put my own image into that
directory and try to access it using the similar url
http://localhost:8080/NoAuth/images/foo.gif
I don’t get any debug to indicate that the autohandler has been
called, and I get the following error
error: Error during compilation of /opt/rt4/share/html/NoAuth/images/foo.gif:
Unrecognized character \x80; marked by ← HERE after foo.gif"
6<-- HERE near column 1425 at /opt/rt4/share/html/NoAuth/images/foo.gif line 18.
Stack:
[/opt/rt4/share/html/NoAuth/images/foo.gif:18]
[/usr/share/perl5/HTML/Mason/Interp.pm:817]
[/usr/share/perl5/HTML/Mason/Interp.pm:458]
[/usr/share/perl5/HTML/Mason/Request.pm:249]
[/usr/share/perl5/HTML/Mason/Request.pm:212]
[/opt/rt4/sbin/…/lib/RT/Interface/Web/Request.pm:62]
[/usr/share/perl5/Class/Container.pm:275]
[/usr/share/perl5/Class/Container.pm:353]
[/usr/share/perl5/HTML/Mason/Interp.pm:348]
[/usr/share/perl5/HTML/Mason/Interp.pm:342]
[/usr/share/perl5/HTML/Mason/PSGIHandler.pm:48]
[/usr/share/perl5/HTML/Mason/PSGIHandler/Streamy.pm:52]
[/opt/rt4/sbin/…/lib/RT/Interface/Web/Handler.pm:263]
[/usr/share/perl5/Plack/Util.pm:315]
[/usr/share/perl5/Plack/Util.pm:315]
[/usr/share/perl5/HTTP/Server/PSGI.pm:185]
[/usr/share/perl5/HTTP/Server/PSGI.pm:134]
[/usr/share/perl5/HTTP/Server/PSGI.pm:62]
[/usr/share/perl5/Plack/Handler/HTTP/Server/PSGI.pm:14]
[/usr/share/perl5/Plack/Loader.pm:87]
[/usr/share/perl5/Plack/Runner.pm:263]
[/opt/rt4/sbin/rt-server:232]
It’s a very great mystery to me.
http://www.linkedin.com/in/paultomblin
http://careers.stackoverflow.com/ptomblin