summaryrefslogtreecommitdiff
path: root/lib/XXV/OUTPUT
diff options
context:
space:
mode:
authorAndreas Brachold <vdr07@deltab.de>2008-02-09 21:22:07 +0000
committerAndreas Brachold <vdr07@deltab.de>2008-02-09 21:22:07 +0000
commit995298ca98a9129f0f24b598637a486f85d4f23e (patch)
treee040c701b1c060c12fbe535fb84e6a30a94d2b8c /lib/XXV/OUTPUT
parente194290db05bf0d1c6b6b49106c2c28197141b6e (diff)
downloadxxv-995298ca98a9129f0f24b598637a486f85d4f23e.tar.gz
xxv-995298ca98a9129f0f24b598637a486f85d4f23e.tar.bz2
* VTX: get font failed with wrong parameter
* HTTPD: deliver static html pages never as attachment
Diffstat (limited to 'lib/XXV/OUTPUT')
-rw-r--r--lib/XXV/OUTPUT/Html.pm36
1 files changed, 21 insertions, 15 deletions
diff --git a/lib/XXV/OUTPUT/Html.pm b/lib/XXV/OUTPUT/Html.pm
index f8bd0ab..2c67976 100644
--- a/lib/XXV/OUTPUT/Html.pm
+++ b/lib/XXV/OUTPUT/Html.pm
@@ -302,8 +302,8 @@ sub parseTemplateFile {
sub out {
# ------------------
my $self = shift || return error('No object defined!');
- my $text = shift || 'no Text for Output';
- my $type = shift || 'text/html';
+ my $text = shift;
+ my $type = shift;
my %args = @_;
unless(defined $self->{header}) {
@@ -311,7 +311,7 @@ sub out {
$self->{output_header} = $self->header($type, \%args);
}
- $self->{output} .= $text,"\r\n"
+ $self->{output} .= $text
if($text);
}
@@ -602,24 +602,29 @@ sub datei {
# ------------------
my $self = shift || return error('No object defined!');
my $file = shift || return error('No file defined!');
- my $typ = shift;
+ my $mimetyp = shift;
my %args = ();
my $fst = stat($file);
unless($fst and ($fst->mode & 00400)) { # mode & S_IRUSR
- error sprintf("Couldn't stat file '%s' : %s",$file,$!);
- return $self->status404($file,$!);
+ my $error = $!;
+ error sprintf("Couldn't stat file '%s' : %s",$file,$error);
+ return $self->status404($file,$error);
}
my $size = $fst->size;
- $typ = $self->{mime}->{lc((split('\.', $file))[-1])}
- unless($typ);
- $typ = "application/octet-stream"
- unless($typ);
-
- $self->{nopack} = 1
- if($typ =~ /image\// || $typ =~ /video\//);
+ $mimetyp = $self->{mime}->{lc((split('\.', $file))[-1])}
+ unless($mimetyp);
+ my $typ;
+ if($mimetyp && $mimetyp->[0]) {
+ $typ = $mimetyp->[0];
+ $self->{nopack} = 1
+ if($mimetyp->[1] && $mimetyp->[1] eq 'nopack');
+ } else {
+ $typ = "application/octet-stream";
+ $self->{nopack} = 1;
+ }
# header only if caching
$args{'ETag'} = sprintf('%x-%x-%x',$fst->ino, $size, $fst->mtime);
@@ -628,9 +633,10 @@ sub datei {
&& $args{'ETag'} eq $self->{browser}->{'Match'});
$args{'Last-Modified'} = datum($fst->mtime,'header');
- $args{'attachment'} = basename($file);
+ $args{'attachment'} = basename($file)
+ if($mimetyp->[2] && $mimetyp->[2] eq 'attachment');
$args{'Content-Length'} = $size
- if($self->{nopack});
+ if($self->{nopack});
if($size > (32768 * 16)) { ## Only files bigger then 512k
lg sprintf("stream file : '%s' (%s)",$file,convert($size));