Subject: | Does not work with CGI::Application::Server |
Brad Bailey initially reported it here:
http://www.nabble.com/CGI%3A%3AApplication%3A%3AServer-and-CGI%3A%3AApplication%3A%3APlugin%3A%3AStream-td21199114.html
His patch works perfectly. Smolder has been rewritten to use
CGI::Application::Server and this is a release blocker for that. So any
help would be appreciated. And just for completeness I'm attaching his
patch to this report too.
Subject: | cgiapp-plugin-stream.patch |
--- Stream.pm.orig 2008-12-28 21:49:47.000000000 -0700
+++ Stream.pm 2008-12-28 21:50:23.000000000 -0700
@@ -75,20 +75,27 @@
$self->header_add('-attachment' => $basename);
}
- $self->header_type( 'none' );
- print $self->query->header( $self->header_props() );
+ unless ($ENV{CGI_APP_RETURN_ONLY}) {
+ $self->header_type( 'none' );
+ print $self->query->header( $self->header_props() )
+ }
# This reads in the file in $byte size chunks
- my $first;
# File::MMagic may have read some of the file, so seek back to the beginning
+ my $output = "";
seek($fh,0,0);
while ( read( $fh, my $buffer, $bytes ) ) {
- print $buffer;
+ if ($ENV{CGI_APP_RETURN_ONLY}) {
+ $output .= $buffer;
+ } else {
+ print $buffer;
+ }
}
- print ''; # print a null string at the end
close ( $fh );
- return 1;
+ print '' unless $ENV{CGI_APP_RETURN_ONLY}; # print a null string at the end
+
+ return $ENV{CGI_APP_RETURN_ONLY} ? \$output : 1;
}
1;