Title: [144474] trunk/Source/WebCore
Revision
144474
Author
[email protected]
Date
2013-03-01 11:13:17 -0800 (Fri, 01 Mar 2013)

Log Message

[Curl] Session cookies should not be persistent.
https://bugs.webkit.org/show_bug.cgi?id=111060

Patch by [email protected] <[email protected]> on 2013-03-01
Reviewed by Brent Fulgham.

Curl saves both persistent cookies, and session cookies to the cookie file.
The session cookies should be deleted before starting a new session.

* platform/network/curl/ResourceHandleManager.cpp:
(WebCore::ResourceHandleManager::ResourceHandleManager): Call method to initialize cookie session.
(WebCore::ResourceHandleManager::initCookieSession): Added method to initialize cookie session.
* platform/network/curl/ResourceHandleManager.h: Added method to initialize cookie session.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (144473 => 144474)


--- trunk/Source/WebCore/ChangeLog	2013-03-01 19:04:26 UTC (rev 144473)
+++ trunk/Source/WebCore/ChangeLog	2013-03-01 19:13:17 UTC (rev 144474)
@@ -1,3 +1,18 @@
+2013-03-01  [email protected]  <[email protected]>
+
+        [Curl] Session cookies should not be persistent.
+        https://bugs.webkit.org/show_bug.cgi?id=111060
+
+        Reviewed by Brent Fulgham.
+
+        Curl saves both persistent cookies, and session cookies to the cookie file.
+        The session cookies should be deleted before starting a new session.
+
+        * platform/network/curl/ResourceHandleManager.cpp:
+        (WebCore::ResourceHandleManager::ResourceHandleManager): Call method to initialize cookie session.
+        (WebCore::ResourceHandleManager::initCookieSession): Added method to initialize cookie session.
+        * platform/network/curl/ResourceHandleManager.h: Added method to initialize cookie session.
+
 2013-03-01  Vsevolod Vlasov  <[email protected]>
 
         Web Inspector: Navigator should show tree element for each folder in the source path.

Modified: trunk/Source/WebCore/platform/network/curl/ResourceHandleManager.cpp (144473 => 144474)


--- trunk/Source/WebCore/platform/network/curl/ResourceHandleManager.cpp	2013-03-01 19:04:26 UTC (rev 144473)
+++ trunk/Source/WebCore/platform/network/curl/ResourceHandleManager.cpp	2013-03-01 19:13:17 UTC (rev 144474)
@@ -131,7 +131,6 @@
     , m_cookieJarFileName(cookieJarPath())
     , m_certificatePath (certificatePath())
     , m_runningJobs(0)
-
 {
     curl_global_init(CURL_GLOBAL_ALL);
     m_curlMultiHandle = curl_multi_init();
@@ -140,6 +139,8 @@
     curl_share_setopt(m_curlShareHandle, CURLSHOPT_SHARE, CURL_LOCK_DATA_DNS);
     curl_share_setopt(m_curlShareHandle, CURLSHOPT_LOCKFUNC, curl_lock_callback);
     curl_share_setopt(m_curlShareHandle, CURLSHOPT_UNLOCKFUNC, curl_unlock_callback);
+
+    initCookieSession();
 }
 
 ResourceHandleManager::~ResourceHandleManager()
@@ -758,6 +759,26 @@
     }
 }
 
+void ResourceHandleManager::initCookieSession()
+{
+    // Curl saves both persistent cookies, and session cookies to the cookie file.
+    // The session cookies should be deleted before starting a new session.
+
+    CURL* curl = curl_easy_init();
+
+    if (!curl)
+        return;
+
+    if (m_cookieJarFileName) {
+        curl_easy_setopt(curl, CURLOPT_COOKIEFILE, m_cookieJarFileName);
+        curl_easy_setopt(curl, CURLOPT_COOKIEJAR, m_cookieJarFileName);
+    }
+
+    curl_easy_setopt(curl, CURLOPT_COOKIESESSION, 1);
+
+    curl_easy_cleanup(curl);
+}
+
 void ResourceHandleManager::cancel(ResourceHandle* job)
 {
     if (removeScheduledJob(job))

Modified: trunk/Source/WebCore/platform/network/curl/ResourceHandleManager.h (144473 => 144474)


--- trunk/Source/WebCore/platform/network/curl/ResourceHandleManager.h	2013-03-01 19:04:26 UTC (rev 144473)
+++ trunk/Source/WebCore/platform/network/curl/ResourceHandleManager.h	2013-03-01 19:13:17 UTC (rev 144474)
@@ -84,6 +84,8 @@
 
     void initializeHandle(ResourceHandle*);
 
+    void initCookieSession();
+
     Timer<ResourceHandleManager> m_downloadTimer;
     CURLM* m_curlMultiHandle;
     CURLSH* m_curlShareHandle;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to