From 5b462768286c2a260882df13551400c23e2dd13a Mon Sep 17 00:00:00 2001 From: nsfisis Date: Thu, 16 Jul 2026 03:27:19 +0900 Subject: refactor(remote-filesystem): return headers from copy/get_contents Wrap RemoteFilesystem in Rc> inside HttpDownloader, in prep for the upcoming &self conversion of add()/get(). copy()/get_contents() now bundle the response headers into their return value instead of requiring a follow-up get_last_headers() call, since two separate calls through a shared RefCell could otherwise race: nothing would guarantee the reader observes the headers from its own request rather than one clobbered by a concurrently borrowed call. get_last_headers() itself is left in place, mirroring RemoteFilesystem::getLastHeaders() in PHP. --- crates/shirabe/tests/util/remote_filesystem_test.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'crates/shirabe/tests/util/remote_filesystem_test.rs') diff --git a/crates/shirabe/tests/util/remote_filesystem_test.rs b/crates/shirabe/tests/util/remote_filesystem_test.rs index 0fdc81b3..43f0aae0 100644 --- a/crates/shirabe/tests/util/remote_filesystem_test.rs +++ b/crates/shirabe/tests/util/remote_filesystem_test.rs @@ -235,7 +235,7 @@ fn test_get_contents() { std::rc::Rc::new(std::cell::RefCell::new(IOStub::new())); let mut fs = RemoteFilesystem::new(io, config_mock(), IndexMap::new(), false, None); - let res = fs + let (res, _headers) = fs .get_contents( "http://example.org", &format!("file://{}", this_file()), @@ -262,7 +262,8 @@ fn test_copy() { false, IndexMap::new() ) - .unwrap(), + .unwrap() + .0, GetResult::True )); assert!(std::path::Path::new(&file).exists()); @@ -358,7 +359,7 @@ fn test_bit_bucket_public_download() { let hostname = parse_url(url, PHP_URL_HOST); let hostname = hostname.as_string().unwrap_or(""); - let result = rfs + let (result, _headers) = rfs .get_contents(hostname, url, false, IndexMap::new()) .unwrap(); -- cgit v1.3.1