Title: [223995] trunk/Source/WebCore
- Revision
- 223995
- Author
- [email protected]
- Date
- 2017-10-25 16:39:09 -0700 (Wed, 25 Oct 2017)
Log Message
[Curl] Delete temporally downloaded file when it cancelled
https://bugs.webkit.org/show_bug.cgi?id=134393
Patch by Basuke Suzuki <[email protected]> on 2017-10-25
Reviewed by Alex Christensen.
* platform/network/curl/CurlRequest.cpp:
(WebCore::CurlRequest::didCancelTransfer):
(WebCore::CurlRequest::writeDataToDownloadFileIfEnabled):
(WebCore::CurlRequest::closeDownloadFile):
(WebCore::CurlRequest::cleanupDownloadFile):
* platform/network/curl/CurlRequest.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (223994 => 223995)
--- trunk/Source/WebCore/ChangeLog 2017-10-25 23:32:49 UTC (rev 223994)
+++ trunk/Source/WebCore/ChangeLog 2017-10-25 23:39:09 UTC (rev 223995)
@@ -1,3 +1,17 @@
+2017-10-25 Basuke Suzuki <[email protected]>
+
+ [Curl] Delete temporally downloaded file when it cancelled
+ https://bugs.webkit.org/show_bug.cgi?id=134393
+
+ Reviewed by Alex Christensen.
+
+ * platform/network/curl/CurlRequest.cpp:
+ (WebCore::CurlRequest::didCancelTransfer):
+ (WebCore::CurlRequest::writeDataToDownloadFileIfEnabled):
+ (WebCore::CurlRequest::closeDownloadFile):
+ (WebCore::CurlRequest::cleanupDownloadFile):
+ * platform/network/curl/CurlRequest.h:
+
2017-10-25 Youenn Fablet <[email protected]>
Add service worker handle fetch support for all subresource requests
Modified: trunk/Source/WebCore/platform/network/curl/CurlRequest.cpp (223994 => 223995)
--- trunk/Source/WebCore/platform/network/curl/CurlRequest.cpp 2017-10-25 23:32:49 UTC (rev 223994)
+++ trunk/Source/WebCore/platform/network/curl/CurlRequest.cpp 2017-10-25 23:39:09 UTC (rev 223995)
@@ -377,6 +377,7 @@
void CurlRequest::didCancelTransfer()
{
finalizeTransfer();
+ cleanupDownloadFile();
}
void CurlRequest::finalizeTransfer()
@@ -610,13 +611,15 @@
void CurlRequest::writeDataToDownloadFileIfEnabled(const SharedBuffer& buffer)
{
- LockHolder locker(m_downloadMutex);
+ {
+ LockHolder locker(m_downloadMutex);
- if (!m_isEnabledDownloadToFile)
- return;
+ if (!m_isEnabledDownloadToFile)
+ return;
- if (m_downloadFilePath.isEmpty())
- m_downloadFilePath = openTemporaryFile("download", m_downloadFileHandle);
+ if (m_downloadFilePath.isEmpty())
+ m_downloadFilePath = openTemporaryFile("download", m_downloadFileHandle);
+ }
if (m_downloadFileHandle != invalidPlatformFileHandle)
writeToFile(m_downloadFileHandle, buffer.data(), buffer.size());
@@ -629,10 +632,20 @@
if (m_downloadFileHandle == invalidPlatformFileHandle)
return;
- WebCore::closeFile(m_downloadFileHandle);
+ closeFile(m_downloadFileHandle);
m_downloadFileHandle = invalidPlatformFileHandle;
}
+void CurlRequest::cleanupDownloadFile()
+{
+ LockHolder locker(m_downloadMutex);
+
+ if (!m_downloadFilePath.isEmpty()) {
+ deleteFile(m_downloadFilePath);
+ m_downloadFilePath = String();
+ }
+}
+
CURLcode CurlRequest::willSetupSslCtxCallback(CURL*, void* sslCtx, void* userData)
{
return static_cast<CurlRequest*>(userData)->willSetupSslCtx(sslCtx);
Modified: trunk/Source/WebCore/platform/network/curl/CurlRequest.h (223994 => 223995)
--- trunk/Source/WebCore/platform/network/curl/CurlRequest.h 2017-10-25 23:32:49 UTC (rev 223994)
+++ trunk/Source/WebCore/platform/network/curl/CurlRequest.h 2017-10-25 23:39:09 UTC (rev 223995)
@@ -117,6 +117,7 @@
// Download
void writeDataToDownloadFileIfEnabled(const SharedBuffer&);
void closeDownloadFile();
+ void cleanupDownloadFile();
// Callback functions for curl
static CURLcode willSetupSslCtxCallback(CURL*, void*, void*);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes