HTTPBodyStream in NSURLRequest gets lost when using CFNetwork loader
authorpsolanki@apple.com <psolanki@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 23 Oct 2011 05:03:19 +0000 (05:03 +0000)
committerpsolanki@apple.com <psolanki@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 23 Oct 2011 05:03:19 +0000 (05:03 +0000)
https://bugs.webkit.org/show_bug.cgi?id=70583
<rdar://problem/10281227>

Reviewed by Darin Adler.

Call WebCore::setHTTPBody() only if we actually have a FormData. Unconditionally calling it
results in us passing 0 to wkCFURLRequestSetHTTPRequestBodyParts() which resets any input
stream specified by the user on the NSURLRequest. This code matches the behavior in the
Foundation version of doUpdatePlatformRequest().

* platform/network/cf/ResourceRequestCFNet.cpp:
(WebCore::ResourceRequest::doUpdatePlatformRequest):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@98198 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp

index 5a24a29..2b3780c 100755 (executable)
@@ -1,3 +1,19 @@
+2011-10-22  Pratik Solanki  <psolanki@apple.com>
+
+        HTTPBodyStream in NSURLRequest gets lost when using CFNetwork loader
+        https://bugs.webkit.org/show_bug.cgi?id=70583
+        <rdar://problem/10281227>
+
+        Reviewed by Darin Adler.
+
+        Call WebCore::setHTTPBody() only if we actually have a FormData. Unconditionally calling it
+        results in us passing 0 to wkCFURLRequestSetHTTPRequestBodyParts() which resets any input
+        stream specified by the user on the NSURLRequest. This code matches the behavior in the
+        Foundation version of doUpdatePlatformRequest().
+
+        * platform/network/cf/ResourceRequestCFNet.cpp:
+        (WebCore::ResourceRequest::doUpdatePlatformRequest):
+
 2011-10-22  Adam Bergkvist  <adam.bergkvist@ericsson.com>
 
         Move all MediaStream and PeerConnection related non-platform files to WebCore/mediastream
index c7aaee4..279d755 100644 (file)
@@ -153,7 +153,9 @@ void ResourceRequest::doUpdatePlatformRequest()
         wkSetHTTPPipeliningPriority(cfRequest, toHTTPPipeliningPriority(m_priority));
 
     setHeaderFields(cfRequest, httpHeaderFields());
-    WebCore::setHTTPBody(cfRequest, httpBody());
+    RefPtr<FormData> formData = httpBody();
+    if (formData && !formData->isEmpty())
+        WebCore::setHTTPBody(cfRequest, formData);
     CFURLRequestSetShouldHandleHTTPCookies(cfRequest, allowCookies());
 
     unsigned fallbackCount = m_responseContentDispositionEncodingFallbackArray.size();