Reviewed by Darin.
[WebKit-https.git] / WebCore / platform / network / cf / ResourceRequestCFNet.cpp
index 9651eba22d82fbbc09fd394ab91536bb458eaf24..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());