[Curl] Fix wrong redirection with relative url when it happens from
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Jan 2018 01:08:29 +0000 (01:08 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Jan 2018 01:08:29 +0000 (01:08 +0000)
different host than original host.
https://bugs.webkit.org/show_bug.cgi?id=181873

Patch by Basuke Suzuki <Basuke.Suzuki@sony.com> on 2018-01-23
Reviewed by Alex Christensen.

* platform/network/curl/CurlDownload.cpp:
(WebCore::CurlDownload::willSendRequest):
* platform/network/curl/ResourceHandleCurlDelegate.cpp:
(WebCore::ResourceHandleCurlDelegate::willSendRequest):

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

Source/WebCore/ChangeLog
Source/WebCore/platform/network/curl/CurlDownload.cpp
Source/WebCore/platform/network/curl/ResourceHandleCurlDelegate.cpp

index 3d32c4e..f02e623 100644 (file)
@@ -1,3 +1,16 @@
+2018-01-23  Basuke Suzuki  <Basuke.Suzuki@sony.com>
+
+        [Curl] Fix wrong redirection with relative url when it happens from
+        different host than original host.
+        https://bugs.webkit.org/show_bug.cgi?id=181873
+
+        Reviewed by Alex Christensen.
+
+        * platform/network/curl/CurlDownload.cpp:
+        (WebCore::CurlDownload::willSendRequest):
+        * platform/network/curl/ResourceHandleCurlDelegate.cpp:
+        (WebCore::ResourceHandleCurlDelegate::willSendRequest):
+
 2018-01-23  Eric Carlson  <eric.carlson@apple.com>
 
         Resign NowPlaying status when no media element is eligible
index d8f9bf3..c033538 100644 (file)
@@ -174,7 +174,7 @@ void CurlDownload::willSendRequest()
     }
 
     String location = m_response.httpHeaderField(HTTPHeaderName::Location);
-    URL newURL = URL(m_request.url(), location);
+    URL newURL = URL(m_response.url(), location);
     bool crossOrigin = !protocolHostAndPortAreEqual(m_request.url(), newURL);
 
     ResourceRequest newRequest = m_request;
index d373af6..36e2501 100644 (file)
@@ -322,7 +322,7 @@ void ResourceHandleCurlDelegate::willSendRequest()
     }
 
     String location = response().httpHeaderField(HTTPHeaderName::Location);
-    URL newURL = URL(m_firstRequest.url(), location);
+    URL newURL = URL(m_handle->getInternal()->m_response.url(), location);
     bool crossOrigin = !protocolHostAndPortAreEqual(m_firstRequest.url(), newURL);
 
     ResourceRequest newRequest = m_firstRequest;