Resolve relative BaseURLs more in line with the spec #1594
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Most streams using BaseURLs that I have ever seen have sensible-looking urls which can simply be concatenated together.
Recently, I became aware of someone using an example like below (truncated for brevity):
Whilst it looks ridiculous, according to the specification, URLs must be resolved according to RFC3986 to give e.g.
http://www.example.com/video/v1_1.m4s
, which is not what was happening.This PR solves this by using the in-built browser URL parser, where available, to resolve URLs correctly with respect to a base URL. Where that URL parser is not available (IE11, Node), I have added a dumb parser which does enough to satisfy an XHR implementation for example.
I have added a number of tests, and have tested this change with as many BaseURL manifests as I could find on Chrome and Firefox (Win7), Edge and IE11 (Win10). NOTE: I have not been able to access a Mac to test this in Safari