Reviewed by Darin.
[WebKit-https.git] / WebCore / platform / network / cf / ResourceRequestCFNet.cpp
index 1dfaf0d8bbc7ad859ea0540fe3626cebaf2880a0..b317f8e00cc274c9ab402db48e64ffde5380f5fe 100644 (file)
@@ -59,12 +59,13 @@ void ResourceRequest::doUpdatePlatformRequest()
 {
     CFMutableURLRequestRef cfRequest;
 
-    if (m_cfRequest) 
+    RetainPtr<CFURLRef> url(AdoptCF, ResourceRequest::url().createCFURL());
+    RetainPtr<CFURLRef> mainDocumentURL(AdoptCF, ResourceRequest::mainDocumentURL().createCFURL());
+    if (m_cfRequest) {
         cfRequest = CFURLRequestCreateMutableCopy(0, m_cfRequest.get());
-    else {
-        RetainPtr<CFURLRef> url(AdoptCF, ResourceRequest::url().createCFURL());
-        RetainPtr<CFURLRef> mainDocumentURL(AdoptCF, ResourceRequest::mainDocumentURL().createCFURL());
-
+        CFURLRequestSetURL(cfRequest, url.get());
+        CFURLRequestSetMainDocumentURL(cfRequest, mainDocumentURL.get());
+    } else {
         cfRequest = CFURLRequestCreateMutable(0, url.get(), (CFURLRequestCachePolicy)cachePolicy(), timeoutInterval(), mainDocumentURL.get());
     }