|
From: Chris W. <la...@us...> - 2001-11-26 13:42:29
|
Update of /cvsroot/openinteract/OpenInteract
In directory usw-pr-cvs1:/tmp/cvs-serv14465
Modified Files:
OpenInteract.pm
Log Message:
set the content-length when sending a non-displayable file
Index: OpenInteract.pm
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract/OpenInteract.pm,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** OpenInteract.pm 2001/11/15 05:19:08 1.21
--- OpenInteract.pm 2001/11/26 13:42:25 1.22
***************
*** 335,345 ****
sub send_static_file {
my ( $class, $R ) = @_;
- my $static_file = $R->{page}{send_file};
my $fh = Apache->gensym;
! eval { open( $fh, $static_file ) || die $!; };
if ( $@ ) {
! $R->scrib( 0, "Cannot open static file from filesystem ($static_file): $@" );
return NOT_FOUND;
}
$R->apache->send_http_header( $R->{page}{content_type} );
$R->apache->send_fd( $fh );
--- 335,351 ----
sub send_static_file {
my ( $class, $R ) = @_;
my $fh = Apache->gensym;
! eval { open( $fh, $R->{page}{send_file} ) || die $!; };
if ( $@ ) {
! $R->scrib( 0, "Cannot open static file from filesystem ($R->{page}{send_file}): $@" );
return NOT_FOUND;
}
+ unless ( $R->{page}{send_file_size} ) {
+ $R->{page}{send_file_size} = (stat $R->{page}{send_file})[7];
+ }
+ $R->apache->headers_out->{'Content-Length'} = $R->{page}{send_file_size};
+ $R->DEBUG && $R->scrib( 1, "Sending file ($R->{page}{send_file}) of size",
+ "($R->{page}{send_file_size}) and type",
+ "($R->{page}{content_type})" );
$R->apache->send_http_header( $R->{page}{content_type} );
$R->apache->send_fd( $fh );
|