[Curl] WebInspector doesn't display request headers added during processing.
authorBasuke.Suzuki@sony.com <Basuke.Suzuki@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Sep 2018 02:42:35 +0000 (02:42 +0000)
committerBasuke.Suzuki@sony.com <Basuke.Suzuki@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Sep 2018 02:42:35 +0000 (02:42 +0000)
https://bugs.webkit.org/show_bug.cgi?id=189531

Reviewed by Alex Christensen.

While processing the request, Curl port network layer adds some headers to the request
such as cookies. Those headers should be displayed in the WebInspector.

Tested on MiniBrowser.

* platform/network/curl/CurlRequest.cpp:
(WebCore::CurlRequest::didReceiveHeader):
(WebCore::CurlRequest::didCompleteTransfer):
(WebCore::CurlRequest::updateNetworkLoadMetrics):
* platform/network/curl/CurlRequest.h:

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

Source/WebCore/ChangeLog
Source/WebCore/platform/network/curl/CurlRequest.cpp
Source/WebCore/platform/network/curl/CurlRequest.h

index 51e47e6..0cd0f5c 100644 (file)
@@ -1,3 +1,21 @@
+2018-09-11  Basuke Suzuki  <Basuke.Suzuki@sony.com>
+
+        [Curl] WebInspector doesn't display request headers added during processing.
+        https://bugs.webkit.org/show_bug.cgi?id=189531
+
+        Reviewed by Alex Christensen.
+
+        While processing the request, Curl port network layer adds some headers to the request
+        such as cookies. Those headers should be displayed in the WebInspector.
+
+        Tested on MiniBrowser.
+
+        * platform/network/curl/CurlRequest.cpp:
+        (WebCore::CurlRequest::didReceiveHeader):
+        (WebCore::CurlRequest::didCompleteTransfer):
+        (WebCore::CurlRequest::updateNetworkLoadMetrics):
+        * platform/network/curl/CurlRequest.h:
+
 2018-09-11  James Savage  <james.savage@apple.com>
 
         Follow up to:
index 726992a..1403dc7 100644 (file)
@@ -301,8 +301,7 @@ size_t CurlRequest::didReceiveHeader(String&& header)
     if (auto version = m_curlHandle->getHttpVersion())
         m_response.httpVersion = *version;
 
-    if (auto metrics = m_curlHandle->getNetworkLoadMetrics())
-        m_networkLoadMetrics = *metrics;
+    updateNetworkLoadMetrics();
 
     if (m_response.availableProxyAuth)
         CurlContext::singleton().setProxyAuthMethod(m_response.availableProxyAuth);
@@ -402,8 +401,7 @@ void CurlRequest::didCompleteTransfer(CURLcode result)
         if (m_multipartHandle)
             m_multipartHandle->didComplete();
 
-        if (auto metrics = m_curlHandle->getNetworkLoadMetrics())
-            m_networkLoadMetrics = *metrics;
+        updateNetworkLoadMetrics();
 
         finalizeTransfer();
         callClient([](CurlRequest& request, CurlRequestClient& client) {
@@ -637,6 +635,14 @@ bool CurlRequest::isHandlePaused() const
     return m_isHandlePaused;
 }
 
+void CurlRequest::updateNetworkLoadMetrics()
+{
+    if (auto metrics = m_curlHandle->getNetworkLoadMetrics())
+        m_networkLoadMetrics = *metrics;
+
+    m_networkLoadMetrics.requestHeaders = m_request.httpHeaderFields();
+}
+
 void CurlRequest::enableDownloadToFile()
 {
     LockHolder locker(m_downloadMutex);
index e4cc4a2..6f78f4f 100644 (file)
@@ -143,6 +143,8 @@ private:
     void updateHandlePauseState(bool);
     bool isHandlePaused() const;
 
+    void updateNetworkLoadMetrics();
+
     // Download
     void writeDataToDownloadFileIfEnabled(const SharedBuffer&);
     void closeDownloadFile();