Changeset 220351 in webkit


Ignore:
Timestamp:
Aug 7, 2017 1:58:50 PM (7 years ago)
Author:
commit-queue@webkit.org
Message:

[Curl] Add abstraction layer of cookie jar implementation for Curl port
https://bugs.webkit.org/show_bug.cgi?id=174943

Patch by Basuke Suzuki <Basuke Suzuki> on 2017-08-07
Reviewed by Brent Fulgham.

  • platform/network/curl/CookieJarCurl.cpp:

(WebCore::CookieJarCurlFileSystem::setCookiesFromDOM):
(WebCore::CookieJarCurlFileSystem::cookiesForDOM):
(WebCore::CookieJarCurlFileSystem::cookieRequestHeaderFieldValue):
(WebCore::CookieJarCurlFileSystem::cookiesEnabled):
(WebCore::CookieJarCurlFileSystem::getRawCookies):
(WebCore::CookieJarCurlFileSystem::deleteCookie):
(WebCore::CookieJarCurlFileSystem::getHostnamesWithCookies):
(WebCore::CookieJarCurlFileSystem::deleteCookiesForHostnames):
(WebCore::CookieJarCurlFileSystem::deleteAllCookies):
(WebCore::CookieJarCurlFileSystem::deleteAllCookiesModifiedSince):
(WebCore::cookiesForDOM):
(WebCore::setCookiesFromDOM):
(WebCore::cookieRequestHeaderFieldValue):
(WebCore::cookiesEnabled):
(WebCore::getRawCookies):
(WebCore::deleteCookie):
(WebCore::getHostnamesWithCookies):
(WebCore::deleteCookiesForHostnames):
(WebCore::deleteAllCookies):
(WebCore::deleteAllCookiesModifiedSince):

  • platform/network/curl/CookieJarCurl.h: Added.
  • platform/network/curl/CurlContext.cpp:
  • platform/network/curl/CurlContext.h:

(WebCore::CurlContext::cookieJar):

Location:
trunk/Source/WebCore
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r220344 r220351  
     12017-08-07  Basuke Suzuki  <Basuke.Suzuki@sony.com>
     2
     3        [Curl] Add abstraction layer of cookie jar implementation for Curl port
     4        https://bugs.webkit.org/show_bug.cgi?id=174943
     5
     6        Reviewed by Brent Fulgham.
     7
     8        * platform/network/curl/CookieJarCurl.cpp:
     9        (WebCore::CookieJarCurlFileSystem::setCookiesFromDOM):
     10        (WebCore::CookieJarCurlFileSystem::cookiesForDOM):
     11        (WebCore::CookieJarCurlFileSystem::cookieRequestHeaderFieldValue):
     12        (WebCore::CookieJarCurlFileSystem::cookiesEnabled):
     13        (WebCore::CookieJarCurlFileSystem::getRawCookies):
     14        (WebCore::CookieJarCurlFileSystem::deleteCookie):
     15        (WebCore::CookieJarCurlFileSystem::getHostnamesWithCookies):
     16        (WebCore::CookieJarCurlFileSystem::deleteCookiesForHostnames):
     17        (WebCore::CookieJarCurlFileSystem::deleteAllCookies):
     18        (WebCore::CookieJarCurlFileSystem::deleteAllCookiesModifiedSince):
     19        (WebCore::cookiesForDOM):
     20        (WebCore::setCookiesFromDOM):
     21        (WebCore::cookieRequestHeaderFieldValue):
     22        (WebCore::cookiesEnabled):
     23        (WebCore::getRawCookies):
     24        (WebCore::deleteCookie):
     25        (WebCore::getHostnamesWithCookies):
     26        (WebCore::deleteCookiesForHostnames):
     27        (WebCore::deleteAllCookies):
     28        (WebCore::deleteAllCookiesModifiedSince):
     29        * platform/network/curl/CookieJarCurl.h: Added.
     30        * platform/network/curl/CurlContext.cpp:
     31        * platform/network/curl/CurlContext.h:
     32        (WebCore::CurlContext::cookieJar):
     33
    1342017-08-07  Brady Eidson  <beidson@apple.com>
    235
  • trunk/Source/WebCore/platform/network/curl/CookieJarCurl.cpp

    r219606 r220351  
    1818
    1919#include "config.h"
    20 #include "PlatformCookieJar.h"
     20#include "CookieJarCurl.h"
    2121
    2222#if USE(CURL)
    23 
    2423#include "Cookie.h"
    2524#include "CurlContext.h"
     
    241240}
    242241
    243 void setCookiesFromDOM(const NetworkStorageSession&, const URL&, const URL& url, const String& value)
     242void CookieJarCurlFileSystem::setCookiesFromDOM(const NetworkStorageSession&, const URL& firstParty, const URL& url, const String& value)
    244243{
    245244    CurlHandle curlHandle;
     
    289288}
    290289
    291 String cookiesForDOM(const NetworkStorageSession& session, const URL& firstParty, const URL& url)
     290String CookieJarCurlFileSystem::cookiesForDOM(const NetworkStorageSession& session, const URL& firstParty, const URL& url)
    292291{
    293292    return cookiesForSession(session, firstParty, url, false);
    294293}
    295294
    296 String cookieRequestHeaderFieldValue(const NetworkStorageSession& session, const URL& firstParty, const URL& url)
     295String CookieJarCurlFileSystem::cookieRequestHeaderFieldValue(const NetworkStorageSession& session, const URL& firstParty, const URL& url)
    297296{
    298297    return cookiesForSession(session, firstParty, url, true);
    299298}
    300299
    301 bool cookiesEnabled(const NetworkStorageSession&, const URL& /*firstParty*/, const URL& /*url*/)
     300bool CookieJarCurlFileSystem::cookiesEnabled(const NetworkStorageSession&, const URL& firstParty, const URL&)
    302301{
    303302    return true;
    304303}
    305304
    306 bool getRawCookies(const NetworkStorageSession&, const URL& /*firstParty*/, const URL& /*url*/, Vector<Cookie>& rawCookies)
     305bool CookieJarCurlFileSystem::getRawCookies(const NetworkStorageSession&, const URL& firstParty, const URL&, Vector<Cookie>& rawCookies)
    307306{
    308307    // FIXME: Not yet implemented
     
    311310}
    312311
    313 void deleteCookie(const NetworkStorageSession&, const URL&, const String&)
    314 {
    315     // FIXME: Not yet implemented
    316 }
    317 
    318 void getHostnamesWithCookies(const NetworkStorageSession&, HashSet<String>&)
    319 {
    320     // FIXME: Not yet implemented
    321 }
    322 
    323 void deleteCookiesForHostnames(const NetworkStorageSession&, const Vector<String>&)
    324 {
    325     // FIXME: Not yet implemented
    326 }
    327 
    328 void deleteAllCookies(const NetworkStorageSession&)
    329 {
    330     // FIXME: Not yet implemented
    331 }
    332 
    333 void deleteAllCookiesModifiedSince(const NetworkStorageSession&, std::chrono::system_clock::time_point)
    334 {
    335     // FIXME: Not yet implemented
     312void CookieJarCurlFileSystem::deleteCookie(const NetworkStorageSession&, const URL&, const String&)
     313{
     314    // FIXME: Not yet implemented
     315}
     316
     317void CookieJarCurlFileSystem::getHostnamesWithCookies(const NetworkStorageSession&, HashSet<String>& hostnames)
     318{
     319    // FIXME: Not yet implemented
     320}
     321
     322void CookieJarCurlFileSystem::deleteCookiesForHostnames(const NetworkStorageSession&, const Vector<String>& cookieHostNames)
     323{
     324    // FIXME: Not yet implemented
     325}
     326
     327void CookieJarCurlFileSystem::deleteAllCookies(const NetworkStorageSession&)
     328{
     329    // FIXME: Not yet implemented
     330}
     331
     332void CookieJarCurlFileSystem::deleteAllCookiesModifiedSince(const NetworkStorageSession&, std::chrono::system_clock::time_point)
     333{
     334    // FIXME: Not yet implemented
     335}
     336
     337// dispatcher functions
     338
     339String cookiesForDOM(const NetworkStorageSession& session, const URL& firstParty, const URL& url)
     340{
     341    return CurlContext::singleton().cookieJar().cookiesForDOM(session, firstParty, url);
     342}
     343
     344void setCookiesFromDOM(const NetworkStorageSession& session, const URL& firstParty, const URL& url, const String& value)
     345{
     346    CurlContext::singleton().cookieJar().setCookiesFromDOM(session, firstParty, url, value);
     347}
     348
     349String cookieRequestHeaderFieldValue(const NetworkStorageSession& session, const URL& firstParty, const URL& url)
     350{
     351    return CurlContext::singleton().cookieJar().cookieRequestHeaderFieldValue(session, firstParty, url);
     352}
     353
     354bool cookiesEnabled(const NetworkStorageSession& session, const URL& firstParty, const URL& url)
     355{
     356    return CurlContext::singleton().cookieJar().cookiesEnabled(session, firstParty, url);
     357}
     358
     359bool getRawCookies(const NetworkStorageSession& session, const URL& firstParty, const URL& url, Vector<Cookie>& rawCookies)
     360{
     361    return CurlContext::singleton().cookieJar().getRawCookies(session, firstParty, url, rawCookies);
     362}
     363
     364void deleteCookie(const NetworkStorageSession& session, const URL& url, const String& cookie)
     365{
     366    CurlContext::singleton().cookieJar().deleteCookie(session, url, cookie);
     367}
     368
     369void getHostnamesWithCookies(const NetworkStorageSession& session, HashSet<String>& hostnames)
     370{
     371    CurlContext::singleton().cookieJar().getHostnamesWithCookies(session, hostnames);
     372}
     373
     374void deleteCookiesForHostnames(const NetworkStorageSession& session, const Vector<String>& cookieHostNames)
     375{
     376    CurlContext::singleton().cookieJar().deleteCookiesForHostnames(session, cookieHostNames);
     377}
     378
     379void deleteAllCookies(const NetworkStorageSession& session)
     380{
     381    CurlContext::singleton().cookieJar().deleteAllCookies(session);
     382}
     383
     384void deleteAllCookiesModifiedSince(const NetworkStorageSession& session, std::chrono::system_clock::time_point since)
     385{
     386    CurlContext::singleton().cookieJar().deleteAllCookiesModifiedSince(session, since);
    336387}
    337388
  • trunk/Source/WebCore/platform/network/curl/CurlContext.cpp

    r219606 r220351  
    107107: m_cookieJarFileName { cookieJarPath() }
    108108, m_certificatePath { certificatePath() }
     109, m_cookieJar { std::make_unique<CookieJarCurlFileSystem>() }
    109110{
    110111    initCookieSession();
  • trunk/Source/WebCore/platform/network/curl/CurlContext.h

    r219948 r220351  
    2727#pragma once
    2828
     29#include "CookieJarCurl.h"
    2930#include "URL.h"
    3031
     
    118119    const char* getCookieJarFileName() const { return m_cookieJarFileName.data(); }
    119120    void setCookieJarFileName(const char* cookieJarFileName) { m_cookieJarFileName = CString(cookieJarFileName); }
     121    CookieJarCurl& cookieJar() { return *m_cookieJar; }
    120122
    121123    // Certificate
     
    138140    CString m_certificatePath;
    139141    CurlShareHandle m_shareHandle;
     142    std::unique_ptr<CookieJarCurl> m_cookieJar;
    140143    bool m_ignoreSSLErrors { false };
    141144
Note: See TracChangeset for help on using the changeset viewer.