diff --git a/extension/httpfs/httpfs.cpp b/extension/httpfs/httpfs.cpp index 34bcc5d..dc7f8d6 100644 --- a/extension/httpfs/httpfs.cpp +++ b/extension/httpfs/httpfs.cpp @@ -286,6 +286,7 @@ HTTPFileHandle::HTTPFileHandle(FileSystem &fs, const OpenFileInfo &file, FileOpe auto &info = file.extended_info->options; auto lm_entry = info.find("last_modified"); if (lm_entry != info.end()) { + last_modified = 0; // keep clang-tidy happy TimestampToTimeT(lm_entry->second.GetValue(), last_modified); } auto etag_entry = info.find("etag"); @@ -301,6 +302,8 @@ HTTPFileHandle::HTTPFileHandle(FileSystem &fs, const OpenFileInfo &file, FileOpe // skip head request initialized = true; } + // copy the rest of the extended info + extended_info = file.extended_info; } } unique_ptr HTTPFileSystem::CreateHandle(const OpenFileInfo &file, FileOpenFlags flags, @@ -672,6 +675,8 @@ void HTTPFileHandle::Initialize(optional_ptr opener) { last_modified = value.last_modified; length = value.length; etag = value.etag; + extended_info = value.extended_info; + if (flags.OpenForReading()) { read_buffer = duckdb::unique_ptr(new data_t[READ_BUFFER_LEN]); @@ -689,7 +694,7 @@ void HTTPFileHandle::Initialize(optional_ptr opener) { FullDownload(hfs, should_write_cache); } if (should_write_cache) { - current_cache->Insert(path, {length, last_modified, etag}); + current_cache->Insert(path, {length, last_modified, etag, extended_info}); } // Initialize the read buffer now that we know the file exists diff --git a/extension/httpfs/include/http_metadata_cache.hpp b/extension/httpfs/include/http_metadata_cache.hpp index 8fc7909..18cd01f 100644 --- a/extension/httpfs/include/http_metadata_cache.hpp +++ b/extension/httpfs/include/http_metadata_cache.hpp @@ -19,6 +19,7 @@ struct HTTPMetadataCacheEntry { idx_t length; time_t last_modified; string etag; + shared_ptr extended_info; }; // Simple cache with a max age for an entry to be valid diff --git a/extension/httpfs/include/httpfs.hpp b/extension/httpfs/include/httpfs.hpp index a6b8570..bca8961 100644 --- a/extension/httpfs/include/httpfs.hpp +++ b/extension/httpfs/include/httpfs.hpp @@ -48,6 +48,7 @@ class HTTPFileHandle : public FileHandle { idx_t length; time_t last_modified; string etag; + shared_ptr extended_info; bool initialized = false; // When using full file download, the full file will be written to a cached file handle