Changeset 265014 in webkit
- Timestamp:
- Jul 28, 2020 3:24:43 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/imported/w3c/ChangeLog
r265002 r265014 1 2020-07-28 Chris Dumez <cdumez@apple.com> 2 3 [EventSource] WebKit fails to UTF-8 encode the Last-Event-ID HTTP header value 4 https://bugs.webkit.org/show_bug.cgi?id=214860 5 6 Reviewed by Alex Christensen and Darin Adler. 7 8 Rebaseline a couple of web-platform-tests that are now passing. 9 10 * web-platform-tests/eventsource/format-field-id-2-expected.txt: 11 * web-platform-tests/eventsource/format-field-id-expected.txt: 12 1 13 2020-07-28 Clark Wang <clark_wang@apple.com> 2 14 -
trunk/LayoutTests/imported/w3c/web-platform-tests/eventsource/format-field-id-2-expected.txt
r220733 r265014 1 1 2 FAIL EventSource: Last-Event-ID (2) assert_equals: expected "hello" but got "…" 2 PASS EventSource: Last-Event-ID (2) 3 3 -
trunk/LayoutTests/imported/w3c/web-platform-tests/eventsource/format-field-id-expected.txt
r220733 r265014 1 1 2 FAIL EventSource: Last-Event-ID assert_equals: expected "hello" but got "…" 2 PASS EventSource: Last-Event-ID 3 3 -
trunk/Source/WebCore/ChangeLog
r265003 r265014 1 2020-07-28 Chris Dumez <cdumez@apple.com> 2 3 [EventSource] WebKit fails to UTF-8 encode the Last-Event-ID HTTP header value 4 https://bugs.webkit.org/show_bug.cgi?id=214860 5 6 Reviewed by Alex Christensen and Darin Adler. 7 8 WebKit fails to UTF-8 encode the Last-Event-ID HTTP header value for EventSource. 9 10 The specification is here: 11 https://html.spec.whatwg.org/multipage/server-sent-events.html#reestablish-the-connection (step 5.3.) 12 13 This is causing us to fail a couple of EventSource web-platform-tests which are passing in both Chrome & Firefox. 14 15 No new tests, rebaselined existing tests. 16 17 * platform/network/cf/ResourceRequestCFNet.cpp: 18 (WebCore::setHeaderFields): 19 * platform/network/cf/ResourceRequestCFNet.h: 20 (WebCore::httpHeaderValueUsingSuitableEncoding): 21 * platform/network/cocoa/ResourceRequestCocoa.mm: 22 (WebCore::ResourceRequest::doUpdatePlatformRequest): 23 1 24 2020-07-28 Fujii Hironori <Hironori.Fujii@sony.com> 2 25 -
trunk/Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp
r264811 r265014 121 121 122 122 for (const auto& header : requestHeaders) 123 CFURLRequestSetHTTPHeaderFieldValue(request, header.key.createCFString().get(), h eader.value.createCFString().get());123 CFURLRequestSetHTTPHeaderFieldValue(request, header.key.createCFString().get(), httpHeaderValueUsingSuitableEncoding(header).get()); 124 124 } 125 125 -
trunk/Source/WebCore/platform/network/cf/ResourceRequestCFNet.h
r264811 r265014 26 26 #pragma once 27 27 28 #include "HTTPHeaderMap.h" 28 29 #include "ResourceLoadPriority.h" 29 30 #include "ResourceRequestBase.h" … … 84 85 } 85 86 87 inline RetainPtr<CFStringRef> httpHeaderValueUsingSuitableEncoding(HTTPHeaderMap::const_iterator::KeyValue header) 88 { 89 if (header.keyAsHTTPHeaderName && *header.keyAsHTTPHeaderName == HTTPHeaderName::LastEventID && !header.value.isAllASCII()) { 90 auto utf8Value = header.value.utf8(); 91 // Constructing a string with the UTF-8 bytes but claiming that it’s Latin-1 is the way to get CFNetwork to put those UTF-8 bytes on the wire. 92 return adoptCF(CFStringCreateWithBytes(nullptr, reinterpret_cast<const UInt8*>(utf8Value.data()), utf8Value.length(), kCFStringEncodingISOLatin1, false)); 93 } 94 return header.value.createCFString(); 95 } 96 86 97 } // namespace WebCore -
trunk/Source/WebCore/platform/network/cocoa/ResourceRequestCocoa.mm
r262708 r265014 194 194 for (NSString *oldHeaderName in [nsRequest allHTTPHeaderFields]) 195 195 [nsRequest setValue:nil forHTTPHeaderField:oldHeaderName]; 196 for (const auto& header : httpHeaderFields()) 197 [nsRequest setValue:header.value forHTTPHeaderField:header.key]; 196 for (const auto& header : httpHeaderFields()) { 197 auto encodedValue = httpHeaderValueUsingSuitableEncoding(header); 198 [nsRequest setValue:(__bridge NSString *)encodedValue.get() forHTTPHeaderField:header.key]; 199 } 198 200 199 201 [nsRequest setContentDispositionEncodingFallbackArray:createNSArray(m_responseContentDispositionEncodingFallbackArray, [] (auto& name) -> NSNumber * {
Note: See TracChangeset
for help on using the changeset viewer.