Title: [223014] trunk/Source
Revision
223014
Author
cdu...@apple.com
Date
2017-10-06 17:25:00 -0700 (Fri, 06 Oct 2017)

Log Message

[Beacon][Cocoa] Beacon requests with BufferSource payload should not have a Content-Type HTTP header
https://bugs.webkit.org/show_bug.cgi?id=178027
<rdar://problem/34748470>

Reviewed by Youenn Fablet.

Source/WebCore/PAL:

Add new CFNetwork SPI.

* pal/spi/cf/CFNetworkSPI.h:

Source/WebKit:

Use new NSURLSessionConfiguration._suppressedAutoAddedHTTPHeaders CFNetwork SPI to
make sure that CFNetwork never adds a Content-Type HTTP headers to our requests
when we did not add one.

This is covered by the following tests on newer OSes:
- imported/w3c/web-platform-tests/beacon/headers/header-content-type.html
- http/tests/blink/sendbeacon/beacon-same-origin.html

* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(WebKit::NetworkSessionCocoa::NetworkSessionCocoa):

Modified Paths

Diff

Modified: trunk/Source/WebCore/PAL/ChangeLog (223013 => 223014)


--- trunk/Source/WebCore/PAL/ChangeLog	2017-10-07 00:18:04 UTC (rev 223013)
+++ trunk/Source/WebCore/PAL/ChangeLog	2017-10-07 00:25:00 UTC (rev 223014)
@@ -1,3 +1,15 @@
+2017-10-06  Chris Dumez  <cdu...@apple.com>
+
+        [Beacon][Cocoa] Beacon requests with BufferSource payload should not have a Content-Type HTTP header
+        https://bugs.webkit.org/show_bug.cgi?id=178027
+        <rdar://problem/34748470>
+
+        Reviewed by Youenn Fablet.
+
+        Add new CFNetwork SPI.
+
+        * pal/spi/cf/CFNetworkSPI.h:
+
 2017-10-05  Dean Jackson  <d...@apple.com>
 
         Lots of missing frames in YouTube360 when fullscreen on MacBook

Modified: trunk/Source/WebCore/PAL/pal/spi/cf/CFNetworkSPI.h (223013 => 223014)


--- trunk/Source/WebCore/PAL/pal/spi/cf/CFNetworkSPI.h	2017-10-07 00:18:04 UTC (rev 223013)
+++ trunk/Source/WebCore/PAL/pal/spi/cf/CFNetworkSPI.h	2017-10-07 00:25:00 UTC (rev 223014)
@@ -134,6 +134,9 @@
 #if PLATFORM(IOS)
 @property (nullable, copy) NSString *_CTDataConnectionServiceType;
 #endif
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000)
+@property (nullable, copy) NSSet *_suppressedAutoAddedHTTPHeaders;
+#endif
 @end
 
 #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000)

Modified: trunk/Source/WebKit/ChangeLog (223013 => 223014)


--- trunk/Source/WebKit/ChangeLog	2017-10-07 00:18:04 UTC (rev 223013)
+++ trunk/Source/WebKit/ChangeLog	2017-10-07 00:25:00 UTC (rev 223014)
@@ -1,3 +1,22 @@
+2017-10-06  Chris Dumez  <cdu...@apple.com>
+
+        [Beacon][Cocoa] Beacon requests with BufferSource payload should not have a Content-Type HTTP header
+        https://bugs.webkit.org/show_bug.cgi?id=178027
+        <rdar://problem/34748470>
+
+        Reviewed by Youenn Fablet.
+
+        Use new NSURLSessionConfiguration._suppressedAutoAddedHTTPHeaders CFNetwork SPI to
+        make sure that CFNetwork never adds a Content-Type HTTP headers to our requests
+        when we did not add one.
+
+        This is covered by the following tests on newer OSes:
+        - imported/w3c/web-platform-tests/beacon/headers/header-content-type.html
+        - http/tests/blink/sendbeacon/beacon-same-origin.html
+
+        * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
+        (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
+
 2017-10-06  Aishwarya Nirmal  <anir...@apple.com>
 
         [iOS] Respect the "caret-color" CSS property when editing 

Modified: trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm (223013 => 223014)


--- trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm	2017-10-07 00:18:04 UTC (rev 223013)
+++ trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm	2017-10-07 00:25:00 UTC (rev 223014)
@@ -572,6 +572,12 @@
 
     NSURLSessionConfiguration *configuration = configurationForSessionID(m_sessionID);
 
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000)
+    // Without this, CFNetwork would sometimes add a Content-Type header to our requests (rdar://problem/34748470).
+    if ([configuration respondsToSelector:@selector(_suppressedAutoAddedHTTPHeaders)])
+        configuration._suppressedAutoAddedHTTPHeaders = [NSSet setWithObject:@"Content-Type"];
+#endif
+
     if (!allowsCellularAccess)
         configuration.allowsCellularAccess = NO;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to