[Curl] Bug fix after r219606
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 26 Jul 2017 15:29:29 +0000 (15:29 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 26 Jul 2017 15:29:29 +0000 (15:29 +0000)
https://bugs.webkit.org/show_bug.cgi?id=174845

Patch by Daewoong Jang <daewoong.jang@navercorp.com> on 2017-07-26
Reviewed by Alex Christensen.

* platform/network/curl/CurlContext.h:
(WebCore::CurlSList::isEmpty):
* platform/network/curl/ResourceHandleCurl.cpp:
(WebCore::ResourceHandleInternal::didReceiveHeaderLine):
(WebCore::ResourceHandleInternal::headerCallback):

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

Source/WebCore/ChangeLog
Source/WebCore/platform/network/curl/CurlContext.h
Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp

index 65e50e6..8b2f948 100644 (file)
@@ -1,3 +1,16 @@
+2017-07-26  Daewoong Jang  <daewoong.jang@navercorp.com>
+
+        [Curl] Bug fix after r219606
+        https://bugs.webkit.org/show_bug.cgi?id=174845
+
+        Reviewed by Alex Christensen.
+
+        * platform/network/curl/CurlContext.h:
+        (WebCore::CurlSList::isEmpty):
+        * platform/network/curl/ResourceHandleCurl.cpp:
+        (WebCore::ResourceHandleInternal::didReceiveHeaderLine):
+        (WebCore::ResourceHandleInternal::headerCallback):
+
 2017-07-26  Zan Dobersek  <zdobersek@igalia.com>
 
         [EME][GStreamer] Multi-key support in the GStreamer ClearKey decryptor
index 53369c0..7d70968 100644 (file)
@@ -179,7 +179,7 @@ public:
     operator struct curl_slist** () { return &m_list; }
 
     const struct curl_slist* head() const { return m_list; }
-    bool isEmpty() const { return m_list; }
+    bool isEmpty() const { return !m_list; }
     void clear()
     {
         if (m_list) {
index 1216c58..62a1133 100644 (file)
@@ -704,6 +704,8 @@ size_t ResourceHandleInternal::willPrepareSendData(char* ptr, size_t blockSize,
 
 void ResourceHandleInternal::didReceiveHeaderLine(const String& header)
 {
+    ASSERT(isMainThread());
+
     auto splitPosition = header.find(":");
     if (splitPosition != notFound) {
         String key = header.left(splitPosition).stripWhiteSpace();
@@ -898,8 +900,12 @@ size_t ResourceHandleInternal::headerCallback(char* ptr, size_t size, size_t nme
             if (!d->m_cancelled)
                 d->didReceiveAllHeaders(httpCode, contentLength);
         });
-    } else
-        d->didReceiveHeaderLine(header);
+    } else {
+        callOnMainThread([job = RefPtr<ResourceHandle>(job), d, header] {
+            if (!d->m_cancelled)
+                d->didReceiveHeaderLine(header);
+        });
+    }
 
     return totalSize;
 }