[Rt-commit] r17409 - rt/3.8/branches/3.8.2-releng/lib/RT/Interface/Web/Mason

falcone at bestpractical.com falcone at bestpractical.com
Mon Dec 29 16:18:54 EST 2008


Author: falcone
Date: Mon Dec 29 16:18:54 2008
New Revision: 17409

Modified:
   rt/3.8/branches/3.8.2-releng/lib/RT/Interface/Web/Mason/ApacheHandler.pm
   rt/3.8/branches/3.8.2-releng/lib/RT/Interface/Web/Mason/CGIHandler.pm

Log:
* merge down fixes for fastcgi handling of images

Modified: rt/3.8/branches/3.8.2-releng/lib/RT/Interface/Web/Mason/ApacheHandler.pm
==============================================================================
--- rt/3.8/branches/3.8.2-releng/lib/RT/Interface/Web/Mason/ApacheHandler.pm	(original)
+++ rt/3.8/branches/3.8.2-releng/lib/RT/Interface/Web/Mason/ApacheHandler.pm	Mon Dec 29 16:18:54 2008
@@ -17,6 +17,9 @@
         $r->content_type($type);
         open my $fh, "<$file" or die "Can't open $file: $!";
         binmode($fh);
+
+        # Read 16384 byte chunks instead of splitting on newlines (so it works
+        # better for binary files)
         local $/ = \16384;
         $r->print($_) while <$fh>;
         return;

Modified: rt/3.8/branches/3.8.2-releng/lib/RT/Interface/Web/Mason/CGIHandler.pm
==============================================================================
--- rt/3.8/branches/3.8.2-releng/lib/RT/Interface/Web/Mason/CGIHandler.pm	(original)
+++ rt/3.8/branches/3.8.2-releng/lib/RT/Interface/Web/Mason/CGIHandler.pm	Mon Dec 29 16:18:54 2008
@@ -12,15 +12,15 @@
     my ($self, $cgi) = @_;
 
     if (my ($file, $type) = $self->image_file_request($cgi->path_info)) {
-        print "HTTP/1.0 200 OK\x0d\x0a";
-        print "Content-Type: $type\x0d\x0a";
-        print "Content-Length: " . (-s $file) . "\x0d\x0a\x0d\x0a";
+        print $cgi->header(-type => $type,
+                           -Content_length => (-s $file) );
         open my $fh, "<$file" or die "Can't open $file: $!";
         binmode($fh);
-        {
-            local $/ = \16384;
-            print $_ while <$fh>;
-        }
+
+        # Read 16384 byte chunks instead of splitting on newlines (so it works
+        # better for binary files)
+        local $/ = \16384;
+        print $_ while <$fh>;
         close $fh;
         return;
     }


More information about the Rt-commit mailing list