@@ -279,7 +279,7 @@ void TimestampToTimeT(timestamp_t timestamp, time_t &result) {
279279HTTPFileHandle::HTTPFileHandle (FileSystem &fs, const OpenFileInfo &file, FileOpenFlags flags,
280280 unique_ptr<HTTPParams> params_p)
281281 : FileHandle(fs, file.path, flags), params(std::move(params_p)), http_params(params->Cast<HTTPFSParams>()),
282- flags (flags), length(0 ), buffer_available(0 ), buffer_idx(0 ), file_offset(0 ), buffer_start(0 ), buffer_end(0 ) {
282+ flags (flags), length(0 ), force_full_download( false ), buffer_available(0 ), buffer_idx(0 ), file_offset(0 ), buffer_start(0 ), buffer_end(0 ) {
283283 // check if the handle has extended properties that can be set directly in the handle
284284 // if we have these properties we don't need to do a head request to obtain them later
285285 if (file.extended_info ) {
@@ -296,6 +296,10 @@ HTTPFileHandle::HTTPFileHandle(FileSystem &fs, const OpenFileInfo &file, FileOpe
296296 if (fs_entry != info.end ()) {
297297 length = fs_entry->second .GetValue <uint64_t >();
298298 }
299+ auto force_full_download_entry = info.find (" force_full_download" );
300+ if (force_full_download_entry != info.end ()) {
301+ force_full_download = force_full_download_entry->second .GetValue <bool >();
302+ }
299303 if (lm_entry != info.end () && etag_entry != info.end () && fs_entry != info.end ()) {
300304 // we found all relevant entries (last_modified, etag and file size)
301305 // skip head request
@@ -595,8 +599,8 @@ optional_idx TryParseContentLength(const HTTPHeaders &headers) {
595599}
596600
597601void HTTPFileHandle::LoadFileInfo () {
598- if (initialized) {
599- // already initialized
602+ if (initialized || force_full_download ) {
603+ // already initialized or we specifically do not want to perform a head request and just run a direct download
600604 return ;
601605 }
602606 auto &hfs = file_system.Cast <HTTPFileSystem>();
@@ -685,7 +689,7 @@ void HTTPFileHandle::Initialize(optional_ptr<FileOpener> opener) {
685689 LoadFileInfo ();
686690
687691 if (flags.OpenForReading ()) {
688- if (http_params.state && length == 0 ) {
692+ if (( http_params.state && length == 0 ) || force_full_download ) {
689693 FullDownload (hfs, should_write_cache);
690694 }
691695 if (should_write_cache) {
0 commit comments