Title: [186895] trunk/Source/WebCore
Revision
186895
Author
beid...@apple.com
Date
2015-07-16 10:25:07 -0700 (Thu, 16 Jul 2015)

Log Message

WebKit document.cookie mis-parsing.
rdar://problem/21715050 and https://bugs.webkit.org/show_bug.cgi?id=146976

Reviewed by Sam Weinig.

* platform/network/cf/CookieJarCFNet.cpp:
(WebCore::createCookies): Use new SPI if available.
(WebCore::setCookiesFromDOM):
* platform/spi/cf/CFNetworkSPI.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (186894 => 186895)


--- trunk/Source/WebCore/ChangeLog	2015-07-16 17:21:40 UTC (rev 186894)
+++ trunk/Source/WebCore/ChangeLog	2015-07-16 17:25:07 UTC (rev 186895)
@@ -1,3 +1,15 @@
+2015-07-16  Brady Eidson  <beid...@apple.com>
+
+        WebKit document.cookie mis-parsing.
+        rdar://problem/21715050 and https://bugs.webkit.org/show_bug.cgi?id=146976
+
+        Reviewed by Sam Weinig.
+
+        * platform/network/cf/CookieJarCFNet.cpp:
+        (WebCore::createCookies): Use new SPI if available.
+        (WebCore::setCookiesFromDOM):
+        * platform/spi/cf/CFNetworkSPI.h:
+
 2015-07-15  Anders Carlsson  <ander...@apple.com>
 
         Headers that use WEBCORE_EXPORT should include PlatformExportMacros.h

Modified: trunk/Source/WebCore/platform/network/cf/CookieJarCFNet.cpp (186894 => 186895)


--- trunk/Source/WebCore/platform/network/cf/CookieJarCFNet.cpp	2015-07-16 17:21:40 UTC (rev 186894)
+++ trunk/Source/WebCore/platform/network/cf/CookieJarCFNet.cpp	2015-07-16 17:25:07 UTC (rev 186895)
@@ -28,6 +28,7 @@
 
 #if USE(CFNETWORK)
 
+#include "CFNetworkSPI.h"
 #include "Cookie.h"
 #include "URL.h"
 #include "NetworkStorageSession.h"
@@ -112,6 +113,15 @@
 #endif
 }
 
+static CFArrayRef createCookies(CFDictionaryRef headerFields, CFURLRef url)
+{
+#if (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 90000)
+    return _CFHTTPParsedCookiesWithResponseHeaderFields(kCFAllocatorDefault, headerFields, url);
+#else
+    return CFHTTPCookieCreateWithResponseHeaderFields(kCFAllocatorDefault, headerFields, url);
+#endif
+}
+
 void setCookiesFromDOM(const NetworkStorageSession& session, const URL& firstParty, const URL& url, const String& value)
 {
     // <rdar://problem/5632883> CFHTTPCookieStorage stores an empty cookie, which would be sent as "Cookie: =".
@@ -130,10 +140,8 @@
         (const void**)&s_setCookieKeyCF, (const void**)&cookieStringCF, 1,
         &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
 
-    RetainPtr<CFArrayRef> cookiesCF = adoptCF(CFHTTPCookieCreateWithResponseHeaderFields(kCFAllocatorDefault,
-        headerFieldsCF.get(), urlCF.get()));
-
-    CFHTTPCookieStorageSetCookies(session.cookieStorage().get(), filterCookies(cookiesCF.get()).get(), urlCF.get(), firstPartyForCookiesCF.get());
+    RetainPtr<CFArrayRef> unfilteredCookies = adoptCF(createCookies(headerFieldsCF.get(), urlCF.get()));
+    CFHTTPCookieStorageSetCookies(session.cookieStorage().get(), filterCookies(unfilteredCookies.get()).get(), urlCF.get(), firstPartyForCookiesCF.get());
 }
 
 String cookiesForDOM(const NetworkStorageSession& session, const URL& firstParty, const URL& url)

Modified: trunk/Source/WebCore/platform/spi/cf/CFNetworkSPI.h (186894 => 186895)


--- trunk/Source/WebCore/platform/spi/cf/CFNetworkSPI.h	2015-07-16 17:21:40 UTC (rev 186894)
+++ trunk/Source/WebCore/platform/spi/cf/CFNetworkSPI.h	2015-07-16 17:25:07 UTC (rev 186895)
@@ -31,6 +31,7 @@
 #if PLATFORM(WIN) || USE(APPLE_INTERNAL_SDK)
 
 #include <CFNetwork/CFHTTPCookies.h>
+#include <CFNetwork/CFHTTPCookiesPriv.h>
 #include <CFNetwork/CFURLCachePriv.h>
 #include <CFNetwork/CFURLProtocolPriv.h>
 #include <CFNetwork/CFURLRequest.h>
@@ -123,6 +124,7 @@
 #if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 90000) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
 EXTERN_C CFDataRef CFHTTPCookieStorageCreateIdentifyingData(CFAllocatorRef inAllocator, CFHTTPCookieStorageRef inStorage);
 EXTERN_C CFHTTPCookieStorageRef CFHTTPCookieStorageCreateFromIdentifyingData(CFAllocatorRef inAllocator, CFDataRef inData);
+EXTERN_C CFArrayRef _CFHTTPParsedCookiesWithResponseHeaderFields(CFAllocatorRef inAllocator, CFDictionaryRef headerFields, CFURLRef inURL);
 #endif
 
 #if defined(__OBJC__)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to