Skip to content

Conversation

@iamszabo
Copy link

Some audio files don't contain the usual Accept-Range: true header, instead it looks more like the following: "Access-Control-Allow-Headers" = "Authorization,Accept,Origin,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range,X-Mx-ReqToken".

This caused an issue when these files could not seek progress, ending up with infinite buffering.

@trafico-bot trafico-bot bot added the 🔍 Ready for Review Pull Request is not reviewed yet label Dec 15, 2022
NSString *accessControlAllowHeaders = ([httpHeaders objectForKey:@"Access-Control-Allow-Headers"] ?: [httpHeaders objectForKey:@"access-control-allow-headers"]);
if (([httpHeaders objectForKey:@"Accept-Ranges"] ?: [httpHeaders objectForKey:@"accept-ranges"]) != nil ||
(accessControlAllowHeaders != nil &&
([accessControlAllowHeaders rangeOfString:@"Range"].location != NSNotFound || [accessControlAllowHeaders rangeOfString:@"range"].location != NSNotFound)))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this potentially be condensed by only needing to check for a single rangeOfString against a lowercased accessControlAllowHeaders?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔍 Ready for Review Pull Request is not reviewed yet size/XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants