[rt-users] Same code, different results

Paul Tomblin ptomblin at xcski.com
Wed Aug 22 10:22:04 EDT 2012


My code makes an ajax call to a mason file that emits some json.  That
mason file uses the exact same techniques that RT's own ajax mason
files use to make sure it isn't polluted with html - it calls
$m->abort after emitting the json.  On my Linux box (Ubuntu 12.04,
some dependencies installed with apt-get, but most through CPAN), that
works fine - I get the results I want.  On my Mac (Mountain Lion, all
dependencies installed with CPAN), the JSON is polluted with html from
my autohandler and from the default RT autohandler.  Can somebody tell
me what is going on, and how do I stop it?  I had some luck with using
<%flags>
inherit => undef
</%flags>
but I'm told that's a massive security hole, so I took it out.

Here is the top bit of my ajax handler file:

% $r->content_type('application/json');
% $m->clear_buffer;
<% JSON::to_json( \@suggestions, { utf8 => 1, allow_blessed => 1,
    convert_blessed => 1, } ) |n %>
% $m->abort;
<%ARGS>
@field => undef
@value => undef
$current => undef
$term => undef
</%ARGS>
<%INIT>


-- 
http://www.linkedin.com/in/paultomblin
http://careers.stackoverflow.com/ptomblin



More information about the rt-users mailing list