X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Fhtml%2FNoAuth%2Fimages%2Fautohandler;h=720979830d5d7e4ad69fe2aff0be8c6952bf2bf7;hb=24548f7cf666bac02335d0bc74f81251c7b4ab50;hp=86f3b2286a2e480de929178d1862901abc3c7664;hpb=d39d52aac8f38ea9115628039f0df5aa3ac826de;p=freeside.git diff --git a/rt/html/NoAuth/images/autohandler b/rt/html/NoAuth/images/autohandler index 86f3b2286..720979830 100644 --- a/rt/html/NoAuth/images/autohandler +++ b/rt/html/NoAuth/images/autohandler @@ -1,21 +1,28 @@ -<%init> +<%INIT> +&RT::Interface::Web::StaticFileHeaders(); # 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 $type = "application/octet-stream"; + +my $type = "application/octet-stream"; if ($file =~ /\.(gif|png|jpe?g)$/i) { $type = "image/$1"; $type =~ s/jpg/jpeg/gi; } -die unless (-f $file && -r $file); +die "file not found" unless -f $file && -r _; + $r->content_type($type); -open (FILE, "<$file") || die; -$m->out($_) while (); -close(FILE); +open my $fh, "<$file" or die "couldn't open file: $!"; +binmode($fh); +{ + local $/ = \16384; + $m->out($_) while (<$fh>); + $m->flush_buffer; +} +close $fh; $m->abort; - +