Ticket #6189: mythweb-trunk-content-range.2.patch

File mythweb-trunk-content-range.2.patch, 1.7 KB (added by Tom Dexter <digitalaudiorock@…>, 11 years ago)
  • mythplugins/mythweb/modules/stream/stream_mp4.pl

     
    5151    binmode DATA;
    5252
    5353    my $start      = 0;
    54     my $end        = $size;
     54    my $end        = $size-1;
    5555    my $total_size = $size;
    5656    my $read_size  = 1024;
    5757    my $mtime      = (stat($filename))[9];
     
    7171    if ($ENV{'HTTP_RANGE'}) {
    7272    # Figure out the size of the requested chunk
    7373        ($start, $end) = $ENV{'HTTP_RANGE'} =~ /bytes\W+(\d*)-(\d*)\W*$/;
    74         if ($end < 1 || $end > $size) {
    75             $end = $size;
     74        $start ||= 0;
     75        $end ||= 0;
     76        if ($end < 1 || $end >= $size) {
     77            $end = $size-1;
    7678        }
    7779        $size = $end - $start+1;
    7880        if ($read_size > $size) {
  • mythplugins/mythweb/modules/stream/stream_raw.pl

     
    5757
    5858# Requested a range?
    5959    my $start      = 0;
    60     my $end        = $size;
     60    my $end        = $size-1;
    6161    my $total_size = $size;
    6262    if ($ENV{'HTTP_RANGE'}) {
    6363    # Figure out the size of the requested chunk
    6464        ($start, $end) = $ENV{'HTTP_RANGE'} =~ /bytes\W+(\d*)-(\d*)\W*$/;
    6565        $start ||= 0;
    66         if ($end < 1 || $end > $size) {
    67             $end = $size;
     66        $end ||= 0;
     67        if ($end < 1 || $end >= $size) {
     68            $end = $size-1;
    6869        }
    69         $size = $end - $start;
     70        $size = $end - $start+1;
    7071    }
    7172
    7273# Print the header