Title: [146621] trunk/Source/WebCore
Revision
146621
Author
[email protected]
Date
2013-03-22 09:22:26 -0700 (Fri, 22 Mar 2013)

Log Message

[Curl] Performance fix, avoid loading cookie file on every request.
https://bugs.webkit.org/show_bug.cgi?id=113023

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

We currently load the cookie file on every request, and when setting cookies from _javascript_, by using the option CURLOPT_COOKIEFILE.
This is very inefficient as the cookie file can get quite large, and file I/O is slow.
It is sufficient to load the cookie file on startup, as we use a shared cookie database between the requests.

* platform/network/curl/CookieJarCurl.cpp:
(WebCore::setCookiesFromDOM): Avoid loading cookie file when setting cookies from _javascript_.
* platform/network/curl/ResourceHandleManager.cpp:
(WebCore::ResourceHandleManager::initializeHandle): Avoid loading cookie file on every request.
(WebCore::ResourceHandleManager::initCookieSession): Load the cookie file to shared database on startup.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (146620 => 146621)


--- trunk/Source/WebCore/ChangeLog	2013-03-22 16:08:54 UTC (rev 146620)
+++ trunk/Source/WebCore/ChangeLog	2013-03-22 16:22:26 UTC (rev 146621)
@@ -1,3 +1,20 @@
+2013-03-22  [email protected]  <[email protected]>
+
+        [Curl] Performance fix, avoid loading cookie file on every request.
+        https://bugs.webkit.org/show_bug.cgi?id=113023
+
+        Reviewed by Brent Fulgham.
+
+        We currently load the cookie file on every request, and when setting cookies from _javascript_, by using the option CURLOPT_COOKIEFILE.
+        This is very inefficient as the cookie file can get quite large, and file I/O is slow.
+        It is sufficient to load the cookie file on startup, as we use a shared cookie database between the requests.
+
+        * platform/network/curl/CookieJarCurl.cpp:
+        (WebCore::setCookiesFromDOM): Avoid loading cookie file when setting cookies from _javascript_.
+        * platform/network/curl/ResourceHandleManager.cpp:
+        (WebCore::ResourceHandleManager::initializeHandle): Avoid loading cookie file on every request.
+        (WebCore::ResourceHandleManager::initCookieSession): Load the cookie file to shared database on startup.
+
 2013-03-22  Tiancheng Jiang  <[email protected]>
 
         [BlackBerry] Update Input field Background Color

Modified: trunk/Source/WebCore/platform/network/curl/CookieJarCurl.cpp (146620 => 146621)


--- trunk/Source/WebCore/platform/network/curl/CookieJarCurl.cpp	2013-03-22 16:08:54 UTC (rev 146620)
+++ trunk/Source/WebCore/platform/network/curl/CookieJarCurl.cpp	2013-03-22 16:22:26 UTC (rev 146621)
@@ -216,7 +216,6 @@
     CURLSH* curlsh = ResourceHandleManager::sharedInstance()->getCurlShareHandle();
 
     curl_easy_setopt(curl, CURLOPT_COOKIEJAR, cookieJarFileName);
-    curl_easy_setopt(curl, CURLOPT_COOKIEFILE, cookieJarFileName);
     curl_easy_setopt(curl, CURLOPT_SHARE, curlsh);
 
     // CURL accepts cookies in either Set-Cookie or Netscape file format.

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


--- trunk/Source/WebCore/platform/network/curl/ResourceHandleManager.cpp	2013-03-22 16:08:54 UTC (rev 146620)
+++ trunk/Source/WebCore/platform/network/curl/ResourceHandleManager.cpp	2013-03-22 16:22:26 UTC (rev 146621)
@@ -713,10 +713,8 @@
     d->m_url = fastStrDup(url.latin1().data());
     curl_easy_setopt(d->m_handle, CURLOPT_URL, d->m_url);
 
-    if (m_cookieJarFileName) {
-        curl_easy_setopt(d->m_handle, CURLOPT_COOKIEFILE, m_cookieJarFileName);
+    if (m_cookieJarFileName)
         curl_easy_setopt(d->m_handle, CURLOPT_COOKIEJAR, m_cookieJarFileName);
-    }
 
     struct curl_slist* headers = 0;
     if (job->firstRequest().httpHeaderFields().size() > 0) {
@@ -769,6 +767,8 @@
     if (!curl)
         return;
 
+    curl_easy_setopt(curl, CURLOPT_SHARE, m_curlShareHandle);
+
     if (m_cookieJarFileName) {
         curl_easy_setopt(curl, CURLOPT_COOKIEFILE, m_cookieJarFileName);
         curl_easy_setopt(curl, CURLOPT_COOKIEJAR, m_cookieJarFileName);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to