@@ -995,13 +995,13 @@ void S3File::S3Cache::Entry::Notify() {
995995
996996void S3File::S3Cache::Entry::Download (S3File &file) {
997997 m_used = false ;
998- m_data.resize (m_cache_entry_size);
999- m_request.reset (new AmazonS3NonblockingDownload<Entry>(
1000- file.m_ai , file.m_object , file.m_log , m_data.data (), *this ));
1001998 size_t request_size = m_cache_entry_size;
1002999 if (m_off + static_cast <off_t >(request_size) > file.content_length ) {
10031000 request_size = file.content_length - m_off;
10041001 }
1002+ m_data.resize (request_size);
1003+ m_request.reset (new AmazonS3NonblockingDownload<Entry>(
1004+ file.m_ai , file.m_object , file.m_log , m_data.data (), *this ));
10051005 // This function is always called with m_mutex held; however,
10061006 // SendRequest can block if the threads are all busy; the threads
10071007 // will need to grab the lock to notify of completion. So, we
@@ -1017,7 +1017,7 @@ void S3File::S3Cache::Entry::Download(S3File &file) {
10171017 file.m_log .Log (LogMask::Debug, " cache" , ss.str ().c_str ());
10181018 }
10191019
1020- if (!m_request->SendRequest (off, m_cache_entry_size )) {
1020+ if (!m_request->SendRequest (off, request_size )) {
10211021 m_parent.m_mutex .lock ();
10221022 std::stringstream ss;
10231023 ss << " Failed to send GetObject command: "
0 commit comments