diff options
| author | Andreas Brachold <vdr07@deltab.de> | 2007-10-27 14:29:27 +0000 |
|---|---|---|
| committer | Andreas Brachold <vdr07@deltab.de> | 2007-10-27 14:29:27 +0000 |
| commit | 1973a994d9306d206bde1e73e7779a1ca73943c4 (patch) | |
| tree | 60600b8ae0200a633583aa8eedead9ee74fafa8b /lib/XXV/OUTPUT/Html.pm | |
| parent | 5c70d02c4b72f4a3384d0b053a8f99e894f0b734 (diff) | |
| download | xxv-1973a994d9306d206bde1e73e7779a1ca73943c4.tar.gz xxv-1973a994d9306d206bde1e73e7779a1ca73943c4.tar.bz2 | |
* HTTPD Add method HEAD
* HTTPD(Ajax) Calc sended bytes
* RECORDS: redit - Display warning message if recording none exist
Diffstat (limited to 'lib/XXV/OUTPUT/Html.pm')
| -rw-r--r-- | lib/XXV/OUTPUT/Html.pm | 48 |
1 files changed, 28 insertions, 20 deletions
diff --git a/lib/XXV/OUTPUT/Html.pm b/lib/XXV/OUTPUT/Html.pm index a3189ed..15e58b9 100644 --- a/lib/XXV/OUTPUT/Html.pm +++ b/lib/XXV/OUTPUT/Html.pm @@ -329,14 +329,19 @@ sub printout { my $nopack = shift || $obj->{nopack} || 0; if($obj->{output} && $obj->{handle}) { - my $content = $obj->{output}; + my $content; + if($obj->{browser}->{Method} ne 'HEAD') { + $content = $obj->{output}; - $content = Compress::Zlib::memGzip($content) - if(! $nopack and $obj->{Zlib} and $obj->{browser}->{accept_gzip}); - - $obj->{handle}->print($obj->{output_header}, $content); + $content = Compress::Zlib::memGzip($content) + if(! $nopack and $obj->{Zlib} and $obj->{browser}->{accept_gzip}); + } + $obj->{handle}->print($obj->{output_header}); $obj->{sendbytes}+= length($obj->{output_header}); - $obj->{sendbytes}+= length($content); + if($content) { + $obj->{handle}->print($content); + $obj->{sendbytes}+= length($content); + } $obj->{handle}->close(); } undef $obj->{output}; @@ -655,22 +660,25 @@ sub datei { local $SIG{'__DIE__'}; my $hdr = $obj->header($typ, \%args); - - my $r = 0; - if(sysopen( FH, $file, O_RDONLY|O_BINARY )) { + if($obj->{browser}->{Method} eq 'HEAD') { $handle->print($hdr); - - my $bytes; - my $data; - do { - $bytes = sysread( FH, $data, 4096 ); - if($bytes) { - $r = $handle->send($data); - } - } while $r && $bytes > 0; - close(FH); } else { - error sprintf("Could not open file '%s'! : %s", $file,$!); + my $r = 0; + if(sysopen( FH, $file, O_RDONLY|O_BINARY )) { + $handle->print($hdr); + + my $bytes; + my $data; + do { + $bytes = sysread( FH, $data, 4096 ); + if($bytes) { + $r = $handle->send($data); + } + } while $r && $bytes > 0; + close(FH); + } else { + error sprintf("Could not open file '%s'! : %s", $file,$!); + } } $handle->close(); }; |
