+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):
+
2007-12-13 Sam Weinig <sam@webkit.org>
Reviewed by Mark Rowe.
{
ResourceHandle* job = static_cast<ResourceHandle*>(data);
ResourceHandleInternal* d = job->getInternal();
- int totalSize = size * nmemb;
+ if (d->m_cancelled)
+ return 0;
+ size_t totalSize = size * nmemb;
// this shouldn't be necessary but apparently is. CURL writes the data
// of html page even if it is a redirect that was handled internally
{
ResourceHandle* job = static_cast<ResourceHandle*>(data);
ResourceHandleInternal* d = job->getInternal();
-
- unsigned int totalSize = size * nmemb;
+ if (d->m_cancelled)
+ return 0;
+ size_t totalSize = size * nmemb;
ResourceHandleClient* client = d->client();
String header(static_cast<const char*>(ptr), totalSize);
if (!msg)
break;
- if (CURLMSG_DONE != msg->msg)
- continue;
-
// find the node which has same d->m_handle as completed transfer
CURL* handle = msg->easy_handle;
ASSERT(handle);
continue;
ResourceHandleInternal* d = job->getInternal();
ASSERT(d->m_handle == handle);
+
+ if (d->m_cancelled) {
+ removeFromCurl(job);
+ continue;
+ }
+
+ if (CURLMSG_DONE != msg->msg)
+ continue;
+
if (CURLE_OK == msg->data.result) {
if (d->client())
d->client()->didFinishLoading(job);
{
if (removeScheduledJob(job))
return;
- removeFromCurl(job);
+ ResourceHandleInternal* d = job->getInternal();
+ d->m_cancelled = true;
+ if (!m_downloadTimer.isActive())
+ m_downloadTimer.startOneShot(pollTimeSeconds);
}
} // namespace WebCore