[interchange-cvs] interchange - heins modified lib/Vend/Dispatch.pm
interchange-core@icdevgroup.org
interchange-core@icdevgroup.org
Wed Jun 25 11:03:00 2003
User: heins
Date: 2003-06-25 15:02:03 GMT
Modified: lib/Vend Dispatch.pm
Log:
* Send Content-Size header with downloads.
Revision Changes Path
1.21 +8 -4 interchange/lib/Vend/Dispatch.pm
rev 1.21, prev_rev 1.20
Index: Dispatch.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Dispatch.pm,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- Dispatch.pm 18 Jun 2003 17:34:44 -0000 1.20
+++ Dispatch.pm 25 Jun 2003 15:02:03 -0000 1.21
@@ -1,6 +1,6 @@
# Vend::Dispatch - Handle Interchange page requests
#
-# $Id: Dispatch.pm,v 1.20 2003/06/18 17:34:44 jon Exp $
+# $Id: Dispatch.pm,v 1.21 2003/06/25 15:02:03 mheins Exp $
#
# Copyright (C) 2002-2003 Interchange Development Group
# Copyright (C) 2002 Mike Heins <mike@perusion.net>
@@ -26,7 +26,7 @@
package Vend::Dispatch;
use vars qw($VERSION);
-$VERSION = substr(q$Revision: 1.20 $, 10);
+$VERSION = substr(q$Revision: 1.21 $, 10);
use POSIX qw(strftime);
use Vend::Util;
@@ -353,8 +353,12 @@
return 0;
}
- $Vend::StatusLine = "Content-Type: " .
- ($CGI::values{mv_content_type} || 'application/octet-stream');
+ my $size = -s $CGI::values{mv_data_file};
+ $CGI::values{mv_content_type} ||= 'application/octet-stream';
+ $Vend::StatusLine = <<EOF;
+Content-Type: $CGI::values{mv_content_type}
+Content-Length: $size
+EOF
::response( Vend::Util::readfile ($CGI::values{mv_data_file}) );
return 0;
}