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_downloader.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'crates/shirabe/src/util/http_downloader.rs') diff --git a/crates/shirabe/src/util/http_downloader.rs b/crates/shirabe/src/util/http_downloader.rs index 77d35b1..610bd3a 100644 --- a/crates/shirabe/src/util/http_downloader.rs +++ b/crates/shirabe/src/util/http_downloader.rs @@ -32,7 +32,7 @@ use crate::util::http::Response; #[derive(Debug)] pub struct HttpDownloader { /// @var IOInterface - io: Box, + io: std::rc::Rc>, /// @var Config config: std::rc::Rc>, /// @var array @@ -103,7 +103,7 @@ impl HttpDownloader { /// @param Config $config The config /// @param mixed[] $options The options pub fn new( - io: Box, + io: std::rc::Rc>, config: std::rc::Rc>, options: IndexMap, disable_tls: bool, @@ -115,8 +115,7 @@ impl HttpDownloader { // The cafile option can be set via config.json let mut self_options: IndexMap = IndexMap::new(); if disable_tls == false { - self_options = - StreamContextFactory::get_tls_defaults(&options, Some(&*io)).unwrap_or_default(); + self_options = StreamContextFactory::get_tls_defaults(&options, ()).unwrap_or_default(); } // handle the other externally set options normally. @@ -124,7 +123,7 @@ impl HttpDownloader { let curl = if Self::is_curl_enabled() { Some(CurlDownloader::new( - io.clone_box(), + io.clone(), config.clone(), options.clone(), disable_tls, @@ -134,7 +133,7 @@ impl HttpDownloader { }; let rfs = Some(RemoteFilesystem::new( - io.clone_box(), + io.clone(), config.clone(), options.clone(), disable_tls, @@ -317,7 +316,7 @@ impl HttpDownloader { ) .unwrap_or(false) { - self.io.set_authentication( + self.io.borrow_mut().set_authentication( origin.clone(), rawurldecode( m.get(&CaptureKey::ByIndex(1)) -- cgit v1.3.1