diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-05-19 00:10:22 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-05-19 00:11:03 +0900 |
| commit | c839244d8d09f3036ebfee8eef7eb6b147e593ab (patch) | |
| tree | fe48c94f2c2e62468beef5ff1a8f3cff6adeef4f /crates/shirabe/src/util/http | |
| parent | 48839250146b217e2756ed3c0e624fd341b54d6c (diff) | |
| download | php-shirabe-c839244d8d09f3036ebfee8eef7eb6b147e593ab.tar.gz php-shirabe-c839244d8d09f3036ebfee8eef7eb6b147e593ab.tar.zst php-shirabe-c839244d8d09f3036ebfee8eef7eb6b147e593ab.zip | |
fix(compile): fix various compile errors
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/util/http')
| -rw-r--r-- | crates/shirabe/src/util/http/curl_downloader.rs | 26 | ||||
| -rw-r--r-- | crates/shirabe/src/util/http/curl_response.rs | 8 | ||||
| -rw-r--r-- | crates/shirabe/src/util/http/proxy_item.rs | 18 | ||||
| -rw-r--r-- | crates/shirabe/src/util/http/proxy_manager.rs | 4 | ||||
| -rw-r--r-- | crates/shirabe/src/util/http/request_proxy.rs | 1 | ||||
| -rw-r--r-- | crates/shirabe/src/util/http/response.rs | 9 |
6 files changed, 38 insertions, 28 deletions
diff --git a/crates/shirabe/src/util/http/curl_downloader.rs b/crates/shirabe/src/util/http/curl_downloader.rs index e4d8b78..d335b8b 100644 --- a/crates/shirabe/src/util/http/curl_downloader.rs +++ b/crates/shirabe/src/util/http/curl_downloader.rs @@ -689,7 +689,7 @@ impl CurlDownloader { if_modified )), true, - <dyn IOInterface>::DEBUG, + crate::io::io_interface::DEBUG, ); } @@ -836,7 +836,7 @@ impl CurlDownloader { .to_string(), ), true, - <dyn IOInterface>::NORMAL, + crate::io::io_interface::NORMAL, ); } @@ -922,7 +922,7 @@ impl CurlDownloader { errno )), true, - <dyn IOInterface>::DEBUG, + crate::io::io_interface::DEBUG, ); self.restart_job_with_delay( &job, @@ -954,7 +954,7 @@ impl CurlDownloader { errno )), true, - <dyn IOInterface>::DEBUG, + crate::io::io_interface::DEBUG, ); let mut attrs: IndexMap<String, PhpMixed> = IndexMap::new(); attrs.insert( @@ -1068,7 +1068,10 @@ impl CurlDownloader { status_code, headers.clone().unwrap_or_default(), contents.as_string().map(|s| s.to_string()), - progress.clone(), + progress + .iter() + .map(|(k, v)| (k.clone(), (**v).clone())) + .collect(), )); self.io.write_error( PhpMixed::String(format!( @@ -1082,7 +1085,7 @@ impl CurlDownloader { ) )), true, - <dyn IOInterface>::DEBUG, + crate::io::io_interface::DEBUG, ); } else { let max_file_size: Option<i64> = job @@ -1141,7 +1144,10 @@ impl CurlDownloader { status_code, headers.clone().unwrap_or_default(), contents.as_string().map(|s| s.to_string()), - progress.clone(), + progress + .iter() + .map(|(k, v)| (k.clone(), (**v).clone())) + .collect(), )); self.io.write_error( PhpMixed::String(format!( @@ -1155,7 +1161,7 @@ impl CurlDownloader { ) )), true, - <dyn IOInterface>::DEBUG, + crate::io::io_interface::DEBUG, ); } fclose(job.get("bodyHandle").cloned().unwrap_or(PhpMixed::Null)); @@ -1304,7 +1310,7 @@ impl CurlDownloader { sc )), true, - <dyn IOInterface>::DEBUG, + crate::io::io_interface::DEBUG, ); let mut attrs: IndexMap<String, PhpMixed> = IndexMap::new(); attrs.insert( @@ -1608,7 +1614,7 @@ impl CurlDownloader { ], )), true, - <dyn IOInterface>::DEBUG, + crate::io::io_interface::DEBUG, ); return Ok(Ok(target_url)); diff --git a/crates/shirabe/src/util/http/curl_response.rs b/crates/shirabe/src/util/http/curl_response.rs index 3c4f923..c6f5d77 100644 --- a/crates/shirabe/src/util/http/curl_response.rs +++ b/crates/shirabe/src/util/http/curl_response.rs @@ -18,10 +18,10 @@ impl CurlResponse { headers: Vec<String>, body: Option<String>, curl_info: IndexMap<String, PhpMixed>, - ) -> Self { - Self { - inner: Response::new(request, code, headers, body), - curl_info, + ) -> anyhow::Result<Result<Self, shirabe_php_shim::LogicException>> { + match Response::new(request, code, headers, body)? { + Ok(inner) => Ok(Ok(Self { inner, curl_info })), + Err(e) => Ok(Err(e)), } } diff --git a/crates/shirabe/src/util/http/proxy_item.rs b/crates/shirabe/src/util/http/proxy_item.rs index 0e30c44..db71476 100644 --- a/crates/shirabe/src/util/http/proxy_item.rs +++ b/crates/shirabe/src/util/http/proxy_item.rs @@ -132,28 +132,22 @@ impl ProxyItem { } pub fn to_request_proxy(&self, scheme: String) -> RequestProxy { - let mut http_options: IndexMap<String, Box<PhpMixed>> = IndexMap::new(); + let mut http_options: IndexMap<String, PhpMixed> = IndexMap::new(); http_options.insert( "proxy".to_string(), - Box::new(PhpMixed::String(self.options_proxy.clone())), + PhpMixed::String(self.options_proxy.clone()), ); if let Some(ref auth) = self.options_auth { - http_options.insert( - "header".to_string(), - Box::new(PhpMixed::String(auth.clone())), - ); + http_options.insert("header".to_string(), PhpMixed::String(auth.clone())); } if scheme == "http" { - http_options.insert( - "request_fulluri".to_string(), - Box::new(PhpMixed::Bool(true)), - ); + http_options.insert("request_fulluri".to_string(), PhpMixed::Bool(true)); } - let mut options: IndexMap<String, Box<PhpMixed>> = IndexMap::new(); - options.insert("http".to_string(), Box::new(PhpMixed::Array(http_options))); + let mut options: IndexMap<String, IndexMap<String, PhpMixed>> = IndexMap::new(); + options.insert("http".to_string(), http_options); RequestProxy::new( Some(self.url.clone()), diff --git a/crates/shirabe/src/util/http/proxy_manager.rs b/crates/shirabe/src/util/http/proxy_manager.rs index e2838e6..5ed8269 100644 --- a/crates/shirabe/src/util/http/proxy_manager.rs +++ b/crates/shirabe/src/util/http/proxy_manager.rs @@ -67,7 +67,7 @@ impl ProxyManager { return Ok(RequestProxy::no_proxy()); } - Ok(proxy.unwrap().to_request_proxy(&scheme)) + Ok(proxy.unwrap().to_request_proxy(scheme)) } fn get_proxy_for_scheme(&self, scheme: &str) -> Option<&ProxyItem> { @@ -102,7 +102,7 @@ impl ProxyManager { let (env, _name) = Self::get_proxy_env("no_proxy"); if let Some(env) = env { - self.no_proxy_handler = Some(NoProxyPattern::new(env)); + self.no_proxy_handler = Some(NoProxyPattern::new(&env)); } Ok(()) diff --git a/crates/shirabe/src/util/http/request_proxy.rs b/crates/shirabe/src/util/http/request_proxy.rs index 5bbf5ce..a85e283 100644 --- a/crates/shirabe/src/util/http/request_proxy.rs +++ b/crates/shirabe/src/util/http/request_proxy.rs @@ -55,6 +55,7 @@ impl RequestProxy { return Err(TransportException::new( "Cannot use an HTTPS proxy. PHP >= 7.3 and cUrl >= 7.52.0 are required." .to_string(), + 0, )); } diff --git a/crates/shirabe/src/util/http/response.rs b/crates/shirabe/src/util/http/response.rs index 6a60540..cf238c7 100644 --- a/crates/shirabe/src/util/http/response.rs +++ b/crates/shirabe/src/util/http/response.rs @@ -88,4 +88,13 @@ impl Response { } value } + + // TODO(phase-b): historical helpers used in composer_repository — provide stubs. + pub fn from_php_mixed(_data: PhpMixed) -> Self { + todo!() + } + + pub fn new_fake(_body: Option<String>) -> Self { + todo!() + } } |
