From f411daceacad66e0bd774fda7d3c5ef8533cc55c Mon Sep 17 00:00:00 2001 From: nsfisis Date: Tue, 26 May 2026 20:04:02 +0900 Subject: refactor(io): share IOInterface via Rc> handle Co-Authored-By: Claude Opus 4.7 --- crates/shirabe/src/util/http/curl_downloader.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'crates/shirabe/src/util/http') diff --git a/crates/shirabe/src/util/http/curl_downloader.rs b/crates/shirabe/src/util/http/curl_downloader.rs index c3a1227..87ea8ef 100644 --- a/crates/shirabe/src/util/http/curl_downloader.rs +++ b/crates/shirabe/src/util/http/curl_downloader.rs @@ -29,6 +29,7 @@ use crate::config::Config; use crate::downloader::MaxFileSizeExceededException; use crate::downloader::TransportException; use crate::io::IOInterface; +use crate::io::IOInterfaceImmutable; use crate::util::HttpDownloader; use crate::util::Platform; use crate::util::StreamContextFactory; @@ -48,7 +49,7 @@ pub struct CurlDownloader { /// @var Job[] jobs: IndexMap>, /// @var IOInterface - io: Box, + io: std::rc::Rc>, /// @var Config config: std::rc::Rc>, /// @var AuthHelper @@ -122,7 +123,7 @@ static TIMEOUT_WARNING: AtomicBool = AtomicBool::new(false); impl CurlDownloader { /// @param mixed[] $options pub fn new( - io: Box, + io: std::rc::Rc>, config: std::rc::Rc>, _options: IndexMap, _disable_tls: bool, @@ -340,7 +341,7 @@ impl CurlDownloader { { self.config .borrow_mut() - .prohibit_url_by_config(url, Some(&*self.io), &options)?; + .prohibit_url_by_config(url, Some(&*self.io.borrow()), &options)?; } let curl_handle = curl_init(); @@ -1184,7 +1185,7 @@ impl CurlDownloader { == Some("application/json") { HttpDownloader::output_warnings( - &*self.io, + &*self.io.borrow(), job.get("origin").and_then(|v| v.as_string()).unwrap_or(""), &match json_decode(response_ref.inner.get_body().unwrap_or(""), true)? { PhpMixed::Array(a) => a.into_iter().map(|(k, v)| (k, *v)).collect(), -- cgit v1.3.1