Changeset 173666 in webkit
- Timestamp:
- Sep 16, 2014 12:22:39 PM (10 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r173665 r173666 1 2014-09-16 peavo@outlook.com <peavo@outlook.com> 2 3 [Curl] Sometimes incomplete or empty content can be loaded from cache. 4 https://bugs.webkit.org/show_bug.cgi?id=136855 5 6 Reviewed by Alex Christensen. 7 8 Sometimes, when two requests with the same url are started at the same time, 9 there is a possibility of loading incomplete or empty content from the cache. 10 This happens because the method CurlCacheEntry::isLoading() is returning the wrong status 11 in the time period between the headers are received, and the content data is received. 12 This can be fixed by using a flag for the load status, instead of checking whether 13 the content file is open. 14 15 * platform/network/curl/CurlCacheEntry.cpp: 16 (WebCore::CurlCacheEntry::CurlCacheEntry): Initialize loading flag. 17 (WebCore::CurlCacheEntry::isLoading): Return loading flag. 18 (WebCore::CurlCacheEntry::didFail): Call new method to set loading flag. 19 (WebCore::CurlCacheEntry::didFinishLoading): Ditto. 20 (WebCore::CurlCacheEntry::setIsLoading): Added new method to set loading flag. 21 * platform/network/curl/CurlCacheEntry.h: Added loading flag and new method to set it. 22 * platform/network/curl/CurlCacheManager.cpp: 23 (WebCore::CurlCacheManager::didReceiveResponse): Call new method to set loading flag. 24 1 25 2014-09-16 Chris Dumez <cdumez@apple.com> 2 26 -
trunk/Source/WebCore/platform/network/curl/CurlCacheEntry.cpp
r173350 r173666 54 54 , m_expireDate(-1) 55 55 , m_headerParsed(false) 56 , m_isLoading(false) 56 57 , m_job(job) 57 58 { … … 70 71 } 71 72 72 bool CurlCacheEntry::isLoading() 73 { 74 return isHandleValid(m_contentFile);73 bool CurlCacheEntry::isLoading() const 74 { 75 return m_isLoading; 75 76 } 76 77 … … 116 117 return false; 117 118 118 job->getInternal()->client()->didReceiveData(job, buffer.data(), buffer.size(), 0); 119 if (buffer.size()) 120 job->getInternal()->client()->didReceiveData(job, buffer.data(), buffer.size(), 0); 121 119 122 return true; 120 123 } … … 200 203 { 201 204 // The cache manager will call invalidate() 202 closeContentFile();205 setIsLoading(false); 203 206 } 204 207 205 208 void CurlCacheEntry::didFinishLoading() 206 209 { 207 closeContentFile();210 setIsLoading(false); 208 211 } 209 212 … … 347 350 } 348 351 352 void CurlCacheEntry::setIsLoading(bool isLoading) 353 { 354 m_isLoading = isLoading; 355 if (m_isLoading) 356 openContentFile(); 357 else 358 closeContentFile(); 359 } 360 349 361 size_t CurlCacheEntry::entrySize() 350 362 { -
trunk/Source/WebCore/platform/network/curl/CurlCacheEntry.h
r169811 r173666 46 46 47 47 bool isCached(); 48 bool isLoading() ;48 bool isLoading() const; 49 49 size_t entrySize(); 50 50 HTTPHeaderMap& requestHeaders() { return m_requestHeaders; } … … 62 62 bool parseResponseHeaders(const ResourceResponse&); 63 63 64 void setIsLoading(bool); 65 64 66 const ResourceHandle* getJob() const { return m_job; } 65 67 … … 74 76 double m_expireDate; 75 77 bool m_headerParsed; 78 bool m_isLoading; 76 79 77 80 ResourceResponse m_cachedResponse; -
trunk/Source/WebCore/platform/network/curl/CurlCacheManager.cpp
r173358 r173666 219 219 bool cacheable = cacheEntry->parseResponseHeaders(response); 220 220 if (cacheable) { 221 cacheEntry->setIsLoading(true); 221 222 m_LRUEntryList.prependOrMoveToFirst(url); 222 223 m_index.set(url, WTF::move(cacheEntry));
Note: See TracChangeset
for help on using the changeset viewer.