Skip to content

Commit

Permalink
use tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
philippe44 authored and mherger committed Oct 11, 2023
1 parent 409df96 commit a36ccb9
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions Slim/Player/Protocols/HTTP.pm
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,15 @@ sub response {
my $self = shift;
my ($args, $request, @headers) = @_;

# re-parse the request string as it might have been overloaded by subclasses
my $request_object = HTTP::Request->parse($request);
# re-parse the request string as it might have been overloaded by subclasses
my $request_object = HTTP::Request->parse($request);

# do we have the range we requested
if ($request_object->header('Range') =~ /^bytes=(\d+)-/ &&
$1 != ($self->contentRange =~ /(\d+)-/)) {
${*$self}{'_skip'} = $1;
$log->info("range request not served, skipping $1 bytes");
}
# do we have the range we requested
if ($request_object->header('Range') =~ /^bytes=(\d+)-/ &&
$1 != ($self->contentRange =~ /(\d+)-/)) {
${*$self}{'_skip'} = $1;
$log->info("range request not served, skipping $1 bytes");
}

# HTTP headers have now been acquired in a blocking way
my $enhance = $self->canEnhanceHTTP($args->{'client'}, $args->{'url'});
Expand Down Expand Up @@ -147,7 +147,7 @@ sub request {
my $track = $song->currentTrack;
my $processor = $track->processors($song->wantFormat);

# no other guidance, define AudioBlock to make sure that audio_offset is skipped in requestString
# no other guidance, define AudioBlock if needed so that audio_offset is skipped in requestString
if (!$processor || $song->stripHeader) {
$song->initialAudioBlock('') if $song->stripHeader;
return $self->SUPER::request($args);
Expand Down Expand Up @@ -588,18 +588,18 @@ sub saveStream {
# object's parent, not the package's parent
# see http://modernperlbooks.com/mt/2009/09/when-super-isnt.html
sub _sysread {
my $self = $_[0];
return CORE::sysread($_[0], $_[1], $_[2], $_[3]) unless ${*$self}{'_skip'};

# skip what we need until done or EOF
my $bytes = CORE::sysread($_[0], $_[1], min(${*$self}{'_skip'}, $_[2]), $_[3]);
return $bytes if defined $bytes && !$bytes;

# pretend we don't have received anything until we've skipped all
${*$self}{'_skip'} -= $bytes if $bytes;
$_[1]= '';
$! = EINTR;
return undef;
my $self = $_[0];
return CORE::sysread($_[0], $_[1], $_[2], $_[3]) unless ${*$self}{'_skip'};

# skip what we need until done or EOF
my $bytes = CORE::sysread($_[0], $_[1], min(${*$self}{'_skip'}, $_[2]), $_[3]);
return $bytes if defined $bytes && !$bytes;

# pretend we don't have received anything until we've skipped all
${*$self}{'_skip'} -= $bytes if $bytes;
$_[1]= '';
$! = EINTR;
return undef;
}

sub sysread {
Expand Down

0 comments on commit a36ccb9

Please sign in to comment.