Changeset 204128 in webkit
- Timestamp:
- Aug 4, 2016 11:48:16 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r204127 r204128 1 2016-08-04 Jeremy Jones <jeremyj@apple.com> 2 3 Temporary redirected m3u8 streaming stopped working. 4 https://bugs.webkit.org/show_bug.cgi?id=160472 5 rdar://problem/27592694 6 7 Reviewed by Alex Christensen. 8 9 This tests that m3u8 files can be loaded when going through a temporary redirect. 10 11 * http/tests/media/hls/hls-redirect-expected.txt: Added. 12 * http/tests/media/hls/hls-redirect.html: Added. 13 1 14 2016-08-04 Alex Christensen <achristensen@webkit.org> 2 15 -
trunk/Source/WebCore/ChangeLog
r204127 r204128 1 2016-08-04 Jeremy Jones <jeremyj@apple.com> 2 3 Temporary redirected m3u8 streaming stopped working. 4 https://bugs.webkit.org/show_bug.cgi?id=160472 5 rdar://problem/27592694 6 7 Reviewed by Alex Christensen. 8 9 Test: http/tests/media/hls/hls-redirect.html 10 11 The change for https://trac.webkit.org/changeset/202466 hides knowledge of the temporary redirected URL from 12 WebCoreNSURLSession clients. MPEG playlists (e.g. .m3u8) can contain paths relative to the redirected URL. 13 14 This change exposes the redirected URL for MPEG playlists. 15 16 * platform/MIMETypeRegistry.cpp: 17 (WebCore::initializeMPEGPlaylistMIMETypes): Added. 18 (WebCore::initializeMIMETypeRegistry): 19 (WebCore::MIMETypeRegistry::isMPEGPlaylistMIMEType): Added. 20 * platform/MIMETypeRegistry.h: 21 * platform/network/cocoa/WebCoreNSURLSession.mm: 22 (-[WebCoreNSURLSessionDataTask resource:receivedResponse:]): Add MPEG playlist condition. 23 (-[WebCoreNSURLSessionDataTask resource:receivedRedirect:request:]): Add MPEG playlist condition. 24 1 25 2016-08-04 Alex Christensen <achristensen@webkit.org> 2 26 -
trunk/Source/WebCore/platform/MIMETypeRegistry.cpp
r195951 r204128 147 147 static HashSet<String, ASCIICaseInsensitiveHash>* supportedNonImageMIMETypes; 148 148 static HashSet<String, ASCIICaseInsensitiveHash>* supportedMediaMIMETypes; 149 static HashSet<String, ASCIICaseInsensitiveHash>* mpegPlaylistMIMETypes; 149 150 static HashSet<String, ASCIICaseInsensitiveHash>* pdfMIMETypes; 150 151 static HashSet<String, ASCIICaseInsensitiveHash>* pdfAndPostScriptMIMETypes; … … 302 303 } 303 304 305 static void initializeMPEGPlaylistMIMETypes() 306 { 307 const char* const types[] = { 308 "application/vnd.apple.mpegurl", 309 "application/mpegurl", 310 "application/x-mpegurl", 311 "audio/mpegurl", 312 "audio/x-mpegurl", 313 "audio/mpegurl", 314 "audio/x-mpegurl" 315 }; 316 317 for (auto& type : types) 318 mpegPlaylistMIMETypes->add(type); 319 } 320 304 321 static void initializePDFMIMETypes() 305 322 { … … 456 473 initializeSupportedImageMIMETypes(); 457 474 475 mpegPlaylistMIMETypes = new HashSet<String, ASCIICaseInsensitiveHash>; 476 initializeMPEGPlaylistMIMETypes(); 477 458 478 pdfMIMETypes = new HashSet<String, ASCIICaseInsensitiveHash>; 459 479 initializePDFMIMETypes(); … … 552 572 || mimeType.startsWith("application/x-java-bean", false) 553 573 || mimeType.startsWith("application/x-java-vm", false); 574 } 575 576 bool MIMETypeRegistry::isMPEGPlaylistMIMEType(const String& mimeType) 577 { 578 if (mimeType.isEmpty()) 579 return false; 580 if (!mpegPlaylistMIMETypes) 581 initializeMIMETypeRegistry(); 582 return mpegPlaylistMIMETypes->contains(mimeType); 554 583 } 555 584 -
trunk/Source/WebCore/platform/MIMETypeRegistry.h
r195951 r204128 77 77 static bool isApplicationPluginMIMEType(const String& mimeType); 78 78 79 // Check to see if a MIME type is one of the MPEG playlists types. 80 static bool isMPEGPlaylistMIMEType(const String& mimeType); 81 79 82 // Check to see if a MIME type is one of the common PDF/PS types. 80 83 WEBCORE_EXPORT static bool isPDFOrPostScriptMIMEType(const String& mimeType); -
trunk/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm
r203008 r204128 30 30 31 31 #import "CachedResourceRequest.h" 32 #import "MIMETypeRegistry.h" 32 33 #import "PlatformMediaResourceLoader.h" 33 34 #import "SecurityOrigin.h" … … 587 588 // certain features of CORS, as well as being against the HTTP spec in the case of 588 589 // non-permanent redirects. 589 auto responseData = response.crossThreadData(); 590 responseData.url = URL(self.currentRequest.URL); 591 strongResponse = ResourceResponseBase::fromCrossThreadData(WTFMove(responseData)).nsURLResponse(); 590 591 // Exclude MPEG Playlists since these require the redirected URL as the base URL 592 // for relative paths. 593 String mimeType = response.nsURLResponse().MIMEType; 594 if (mimeType.isEmpty() || mimeType == "application/octet-stream" || mimeType == "text/plain") { 595 String extension = response.nsURLResponse().URL.pathExtension; 596 mimeType = MIMETypeRegistry::getMediaMIMETypeForExtension(extension); 597 598 } 599 if (!MIMETypeRegistry::isMPEGPlaylistMIMEType(mimeType)) { 600 auto responseData = response.crossThreadData(); 601 responseData.url = URL(self.currentRequest.URL); 602 strongResponse = ResourceResponseBase::fromCrossThreadData(WTFMove(responseData)).nsURLResponse(); 603 } 592 604 } 593 605 … … 659 671 // Do not update the current request if the redirect is temporary; use this 660 672 // current request during responseReceieved: to work around a CoreMedia bug. 661 if (response.httpStatusCode() != 302 && response.httpStatusCode() != 307) 662 self.currentRequest = [NSURLRequest requestWithURL:request.url()]; 673 674 // Exclude MPEG Playlists since these require the redirected URL as the base URL 675 // for relative paths. 676 if (response.httpStatusCode() != 302 && response.httpStatusCode() != 307) { 677 String mimeType = response.nsURLResponse().MIMEType; 678 if (mimeType.isEmpty() || mimeType == "application/octet-stream" || mimeType == "text/plain") { 679 String extension = response.nsURLResponse().URL.pathExtension; 680 mimeType = MIMETypeRegistry::getMediaMIMETypeForExtension(extension); 681 } 682 if (!MIMETypeRegistry::isMPEGPlaylistMIMEType(mimeType)) 683 self.currentRequest = [NSURLRequest requestWithURL:request.url()]; 684 } 663 685 664 686 [self.session updateHasSingleSecurityOrigin:SecurityOrigin::create(request.url())];
Note: See TracChangeset
for help on using the changeset viewer.