Title: [229032] trunk/Source/WebCore
- Revision
- 229032
- Author
- [email protected]
- Date
- 2018-02-26 12:02:40 -0800 (Mon, 26 Feb 2018)
Log Message
[Curl] Cookies are not being added to the Cookie field in Request Headers
https://bugs.webkit.org/show_bug.cgi?id=183095
Patch by Christopher Reid <[email protected]> on 2018-02-26
Reviewed by Alex Christensen.
Populating the Cookie request header field now that cookies are no longer handled in libcurl.
* platform/network/curl/CookieJarCurlDatabase.cpp: Renaming the httpOnly variable as its actual use wasn't clear
* platform/network/curl/ResourceHandleCurl.cpp:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (229031 => 229032)
--- trunk/Source/WebCore/ChangeLog 2018-02-26 19:53:09 UTC (rev 229031)
+++ trunk/Source/WebCore/ChangeLog 2018-02-26 20:02:40 UTC (rev 229032)
@@ -1,3 +1,15 @@
+2018-02-26 Christopher Reid <[email protected]>
+
+ [Curl] Cookies are not being added to the Cookie field in Request Headers
+ https://bugs.webkit.org/show_bug.cgi?id=183095
+
+ Reviewed by Alex Christensen.
+
+ Populating the Cookie request header field now that cookies are no longer handled in libcurl.
+
+ * platform/network/curl/CookieJarCurlDatabase.cpp: Renaming the httpOnly variable as its actual use wasn't clear
+ * platform/network/curl/ResourceHandleCurl.cpp:
+
2018-02-26 Antoine Quint <[email protected]>
[Web Animations] Ensure setting the hold time invalidates the timing model
Modified: trunk/Source/WebCore/platform/network/curl/CookieJarCurlDatabase.cpp (229031 => 229032)
--- trunk/Source/WebCore/platform/network/curl/CookieJarCurlDatabase.cpp 2018-02-26 19:53:09 UTC (rev 229031)
+++ trunk/Source/WebCore/platform/network/curl/CookieJarCurlDatabase.cpp 2018-02-26 20:02:40 UTC (rev 229032)
@@ -38,16 +38,16 @@
namespace WebCore {
-static String cookiesForSession(const NetworkStorageSession& session, const URL&, const URL& url, bool httponly)
+static String cookiesForSession(const NetworkStorageSession& session, const URL&, const URL& url, bool forHTTPHeader)
{
StringBuilder cookies;
CookieJarDB& cookieJarDB = session.cookieDatabase();
- auto isHttpOnly = (httponly ? std::nullopt : std::optional<bool> {false});
+ auto searchHTTPOnly = (forHTTPHeader ? std::nullopt : std::optional<bool> {false});
auto secure = url.protocolIs("https") ? std::nullopt : std::optional<bool> {false};
Vector<Cookie> results;
- if (cookieJarDB.searchCookies(url.string(), isHttpOnly, secure, std::nullopt, results)) {
+ if (cookieJarDB.searchCookies(url.string(), searchHTTPOnly, secure, std::nullopt, results)) {
for (auto result : results) {
if (!cookies.isEmpty())
cookies.append("; ");
Modified: trunk/Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp (229031 => 229032)
--- trunk/Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp 2018-02-26 19:53:09 UTC (rev 229031)
+++ trunk/Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp 2018-02-26 20:02:40 UTC (rev 229032)
@@ -33,6 +33,7 @@
#if USE(CURL)
#include "CookieJarCurl.h"
+#include "CookiesStrategy.h"
#include "CredentialStorage.h"
#include "CurlCacheManager.h"
#include "CurlContext.h"
@@ -40,6 +41,7 @@
#include "FileSystem.h"
#include "HTTPParsers.h"
#include "Logging.h"
+#include "NetworkStorageSession.h"
#include "ResourceHandleInternal.h"
#include "SharedBuffer.h"
#include "SynchronousLoaderClient.h"
@@ -132,6 +134,13 @@
}
}
+ auto& storageSession = NetworkStorageSession::defaultStorageSession();
+ auto& cookieJar = storageSession.cookieStorage();
+ auto includeSecureCookies = request.url().protocolIs("https") ? IncludeSecureCookies::Yes : IncludeSecureCookies::No;
+ String cookieHeaderField = cookieJar.cookieRequestHeaderFieldValue(storageSession, request.firstPartyForCookies(), request.url(), std::nullopt, std::nullopt, includeSecureCookies).first;
+ if (!cookieHeaderField.isEmpty())
+ request.addHTTPHeaderField(HTTPHeaderName::Cookie, cookieHeaderField);
+
CurlRequest::ShouldSuspend shouldSuspend = d->m_defersLoading ? CurlRequest::ShouldSuspend::Yes : CurlRequest::ShouldSuspend::No;
auto curlRequest = CurlRequest::create(request, *delegate(), shouldSuspend, CurlRequest::EnableMultipart::Yes);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes