Changeset 28709 in webkit


Ignore:
Timestamp:
Dec 13, 2007 7:37:49 PM (16 years ago)
Author:
alp@webkit.org
Message:

2007-12-13 Alp Toker <alp@atoker.com>

Reviewed by Oliver Hunt.

http://bugs.webkit.org/show_bug.cgi?id=16365
[cURL] Acid2 test segmentation fault

This patch makes the Acid2 test pass.

Defer the cleanup of cancelled jobs and halt further transfer as early
as possible.

Bug found by and initial patch provided by Luca Bruno.

  • platform/network/curl/ResourceHandleManager.cpp: (WebCore::writeCallback): (WebCore::headerCallback): (WebCore::ResourceHandleManager::downloadTimerCallback): (WebCore::ResourceHandleManager::cancel):
Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r28708 r28709  
     12007-12-13  Alp Toker  <alp@atoker.com>
     2
     3        Reviewed by Oliver Hunt.
     4
     5        http://bugs.webkit.org/show_bug.cgi?id=16365
     6        [cURL] Acid2 test segmentation fault
     7
     8        This patch makes the Acid2 test pass.
     9
     10        Defer the cleanup of cancelled jobs and halt further transfer as early
     11        as possible.
     12
     13        Bug found by and initial patch provided by Luca Bruno.
     14
     15        * platform/network/curl/ResourceHandleManager.cpp:
     16        (WebCore::writeCallback):
     17        (WebCore::headerCallback):
     18        (WebCore::ResourceHandleManager::downloadTimerCallback):
     19        (WebCore::ResourceHandleManager::cancel):
     20
    1212007-12-13  Sam Weinig  <sam@webkit.org>
    222
  • trunk/WebCore/platform/network/curl/ResourceHandleManager.cpp

    r28643 r28709  
    8585    ResourceHandle* job = static_cast<ResourceHandle*>(data);
    8686    ResourceHandleInternal* d = job->getInternal();
    87     int totalSize = size * nmemb;
     87    if (d->m_cancelled)
     88        return 0;
     89    size_t totalSize = size * nmemb;
    8890
    8991    // this shouldn't be necessary but apparently is. CURL writes the data
     
    128130    ResourceHandle* job = static_cast<ResourceHandle*>(data);
    129131    ResourceHandleInternal* d = job->getInternal();
    130 
    131     unsigned int totalSize = size * nmemb;
     132    if (d->m_cancelled)
     133        return 0;
     134    size_t totalSize = size * nmemb;
    132135    ResourceHandleClient* client = d->client();
    133136
     
    227230        if (!msg)
    228231            break;
    229 
    230         if (CURLMSG_DONE != msg->msg)
    231             continue;
    232232
    233233        // find the node which has same d->m_handle as completed transfer
     
    242242        ResourceHandleInternal* d = job->getInternal();
    243243        ASSERT(d->m_handle == handle);
     244
     245        if (d->m_cancelled) {
     246            removeFromCurl(job);
     247            continue;
     248        }
     249
     250        if (CURLMSG_DONE != msg->msg)
     251            continue;
     252
    244253        if (CURLE_OK == msg->data.result) {
    245254            if (d->client())
     
    503512    if (removeScheduledJob(job))
    504513        return;
    505     removeFromCurl(job);
     514    ResourceHandleInternal* d = job->getInternal();
     515    d->m_cancelled = true;
     516    if (!m_downloadTimer.isActive())
     517        m_downloadTimer.startOneShot(pollTimeSeconds);
    506518}
    507519
Note: See TracChangeset for help on using the changeset viewer.