aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/util/http_downloader.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-20 18:34:54 +0900
committernsfisis <nsfisis@gmail.com>2026-06-20 18:34:54 +0900
commit81b9fc9d92bb74aa8428ae4db39bd84e8c16095c (patch)
tree3efb6476d797e2a95545c4c3abba468c3e3c8d52 /crates/shirabe/src/util/http_downloader.rs
parentc09cd630afb4bb0ca10e926f93bf706ca828ae85 (diff)
downloadphp-shirabe-81b9fc9d92bb74aa8428ae4db39bd84e8c16095c.tar.gz
php-shirabe-81b9fc9d92bb74aa8428ae4db39bd84e8c16095c.tar.zst
php-shirabe-81b9fc9d92bb74aa8428ae4db39bd84e8c16095c.zip
refactor(php-shim): drop Box wrapping from PhpMixed List/Array
The List and Array variants of PhpMixed boxed their elements unnecessarily. Store PhpMixed values directly and update all callers accordingly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/util/http_downloader.rs')
-rw-r--r--crates/shirabe/src/util/http_downloader.rs19
1 files changed, 8 insertions, 11 deletions
diff --git a/crates/shirabe/src/util/http_downloader.rs b/crates/shirabe/src/util/http_downloader.rs
index 929dd67..d5d619d 100644
--- a/crates/shirabe/src/util/http_downloader.rs
+++ b/crates/shirabe/src/util/http_downloader.rs
@@ -454,7 +454,7 @@ impl HttpDownloader {
_ => None,
})
.cloned();
- if let Some(PhpMixed::List(list)) = http_header.as_deref() {
+ if let Some(PhpMixed::List(list)) = http_header.as_ref() {
let joined = implode(
"",
&list
@@ -463,7 +463,7 @@ impl HttpDownloader {
.collect::<Vec<_>>(),
);
stripos(&joined, "if-modified-since").is_some()
- } else if let Some(PhpMixed::Array(m)) = http_header.as_deref() {
+ } else if let Some(PhpMixed::Array(m)) = http_header.as_ref() {
let joined = implode(
"",
&m.values()
@@ -718,7 +718,7 @@ impl HttpDownloader {
if let Some(PhpMixed::List(list)) = entry {
for spec in list {
let r#type = substr(key, 0, Some(-1));
- if let PhpMixed::Array(spec_map) = spec.as_ref() {
+ if let PhpMixed::Array(spec_map) = spec {
let constraint = version_parser.parse_constraints(
spec_map
.get("versions")
@@ -769,15 +769,12 @@ impl HttpDownloader {
{
Silencer::suppress(None);
let mut ctx_options: IndexMap<String, PhpMixed> = IndexMap::new();
- let mut ssl_map: IndexMap<String, Box<PhpMixed>> = IndexMap::new();
- ssl_map.insert("verify_peer".to_string(), Box::new(PhpMixed::Bool(false)));
+ let mut ssl_map: IndexMap<String, PhpMixed> = IndexMap::new();
+ ssl_map.insert("verify_peer".to_string(), PhpMixed::Bool(false));
ctx_options.insert("ssl".to_string(), PhpMixed::Array(ssl_map));
- let mut http_map: IndexMap<String, Box<PhpMixed>> = IndexMap::new();
- http_map.insert(
- "follow_location".to_string(),
- Box::new(PhpMixed::Bool(false)),
- );
- http_map.insert("ignore_errors".to_string(), Box::new(PhpMixed::Bool(true)));
+ let mut http_map: IndexMap<String, PhpMixed> = IndexMap::new();
+ http_map.insert("follow_location".to_string(), PhpMixed::Bool(false));
+ http_map.insert("ignore_errors".to_string(), PhpMixed::Bool(true));
ctx_options.insert("http".to_string(), PhpMixed::Array(http_map));
// TODO(phase-c): file_get_contents only takes a path; the stream context arg is dropped
// until the PHP stream-context layer is modeled.