1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package Static;
use CGI::Application::Plugins::Stream qw(stream_file);
[..]
sub setup {
my $self = shift;
$self->start_mode('stream');
$self->run_modes(
'stream' => 'stream'
);
}
sub stream {
my ($self) = @_;
$| = 1;
my $staticdir = $self->param('staticdir');
$self->header_add(-Content_Disposition => "Inline", -Server => "CGIServer");
my $file = ''; $file = $self->query->path_info();
$file =~ s/^\/static\///;
$file = "$staticdir/$file";
my $absfile = abs_path($file) or return $self->file_not_found();
$self->header_add(-content_type => 'text/css') if ($absfile =~ /\.css$/);
$self->header_add(-content_type => 'audio/mpeg') if ($absfile =~ /\.mp3$/);
# Verhindere Path Traversal Attacks
if ($absfile =~ /^$staticdir\// && $self->stream_file( $absfile, 2048 ) ) {
return;
} else {
$self->file_not_found()
}
}
[...]
2017-10-03T17:05:06 GwenDragonIch lasse audio und video direkt ausliefern.
CGI bremst zu sehr und außerdem kann auch nicht an einer bestimmten Stelle (Stichpunkt: Partial Content, Resume) des MP3 wieder aufsetzen und weiter abspielen.
Quote::1 localhost - [04/Oct/2017:19:32:27 +0200] "GET /static/files/media/Musik/Lieder/Waer_ich_ein_Stern.mp3 HTTP/1.1" 200 21713 "http://localhost/hoerproben" "Mozilla/5.0 (X11; Linux x86_64; rv:56.0) Gecko/20100101 Firefox/56.0"
Quote[Wed Oct 4 19:24:47 2017] PLog.cgi: Redundant argument in sprintf at /home/maximilian/public_html/extlib/lib/perl5/File/MMagic.pm line 932.
[Wed Oct 4 19:32:27 2017] PLog.cgi: Error executing run mode 'show': can't open /home/maximilian/public_html/userdir/pages//favicon.ico.storable: No such file or directory at /home/maximilian/public_html/lib/PLog/View.pm line 84.
[Wed Oct 4 19:32:27 2017] PLog.cgi: at /home/maximilian/public_html/cgi-bin/PLog.cgi line 49.
QuoteContent-disposition: Inline
Content-length: 8289046
Server: CGIServer
Content-Type: audio/mpeg; charset=ISO-8859-1
Date: Wed, 04 Oct 2017 18:01:53 GMT
QuoteHost: localhost
User-Agent: Mozilla/5.0 (X11; Linux x86_64…) Gecko/20100101 Firefox/56.0
Accept: audio/webm,audio/ogg,audio/wav…q=0.7,video/*;q=0.6,*/*;q=0.5
Accept-Language: de,en-US;q=0.7,en;q=0.3
Referer: http://localhost/hoerproben
Range: bytes=0-
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache