Reviewed by Darin.
[WebKit-https.git] / WebCore / platform / network / cf / ResourceRequestCFNet.cpp
index 44d3c435081a9b95415837b370eda1a42bbe3399..b317f8e00cc274c9ab402db48e64ffde5380f5fe 100644 (file)
@@ -57,10 +57,17 @@ static inline void addHeadersFromHashMap(CFMutableURLRequestRef request, const H
 
 void ResourceRequest::doUpdatePlatformRequest()
 {
+    CFMutableURLRequestRef cfRequest;
+
     RetainPtr<CFURLRef> url(AdoptCF, ResourceRequest::url().createCFURL());
     RetainPtr<CFURLRef> mainDocumentURL(AdoptCF, ResourceRequest::mainDocumentURL().createCFURL());
-
-    CFMutableURLRequestRef cfRequest = CFURLRequestCreateMutable(0, url.get(), (CFURLRequestCachePolicy)cachePolicy(), timeoutInterval(), mainDocumentURL.get());
+    if (m_cfRequest) {
+        cfRequest = CFURLRequestCreateMutableCopy(0, m_cfRequest.get());
+        CFURLRequestSetURL(cfRequest, url.get());
+        CFURLRequestSetMainDocumentURL(cfRequest, mainDocumentURL.get());
+    } else {
+        cfRequest = CFURLRequestCreateMutable(0, url.get(), (CFURLRequestCachePolicy)cachePolicy(), timeoutInterval(), mainDocumentURL.get());
+    }
 
     RetainPtr<CFStringRef> requestMethod(AdoptCF, httpMethod().createCFString());
     CFURLRequestSetHTTPRequestMethod(cfRequest, requestMethod.get());
@@ -70,11 +77,7 @@ void ResourceRequest::doUpdatePlatformRequest()
     CFURLRequestSetShouldHandleHTTPCookies(cfRequest, allowHTTPCookies());
 
     if (m_cfRequest) {
-#ifdef CFNETWORK_HAS_NEW_COOKIE_FUNCTIONS
-        RetainPtr<CFHTTPCookieStorageRef> cookieStorage(AdoptCF, CFURLRequestCopyHTTPCookieStorage(m_cfRequest.get()));
-        CFURLRequestSetHTTPCookieStorage(cfRequest, cookieStorage.get());
         CFURLRequestSetHTTPCookieStorageAcceptPolicy(cfRequest, CFURLRequestGetHTTPCookieStorageAcceptPolicy(m_cfRequest.get()));
-#endif
         CFURLRequestSetSSLProperties(cfRequest, CFURLRequestGetSSLProperties(m_cfRequest.get()));
     }