diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-05-17 02:53:53 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-05-17 02:53:53 +0900 |
| commit | a1c7e6908a26e10f6e1f23a51721664b5e2d838d (patch) | |
| tree | c575c76f1b43359ed74913da4c6a2636643f1ba0 /crates/shirabe/src/util/http/proxy_item.rs | |
| parent | 7f606f36fef0c0467c3c0db3d0da33af486dae8a (diff) | |
| download | php-shirabe-a1c7e6908a26e10f6e1f23a51721664b5e2d838d.tar.gz php-shirabe-a1c7e6908a26e10f6e1f23a51721664b5e2d838d.tar.zst php-shirabe-a1c7e6908a26e10f6e1f23a51721664b5e2d838d.zip | |
chore(style): cargo fmt
Diffstat (limited to 'crates/shirabe/src/util/http/proxy_item.rs')
| -rw-r--r-- | crates/shirabe/src/util/http/proxy_item.rs | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/crates/shirabe/src/util/http/proxy_item.rs b/crates/shirabe/src/util/http/proxy_item.rs index f32325d..0e30c44 100644 --- a/crates/shirabe/src/util/http/proxy_item.rs +++ b/crates/shirabe/src/util/http/proxy_item.rs @@ -1,10 +1,10 @@ //! ref: composer/src/Composer/Util/Http/ProxyItem.php +use crate::util::http::request_proxy::RequestProxy; use indexmap::IndexMap; use shirabe_php_shim::{ - base64_encode, parse_url_all, rawurldecode, strpbrk, PhpMixed, RuntimeException, + PhpMixed, RuntimeException, base64_encode, parse_url_all, rawurldecode, strpbrk, }; -use crate::util::http::request_proxy::RequestProxy; #[derive(Debug)] pub struct ProxyItem { @@ -20,12 +20,20 @@ impl ProxyItem { let syntax_error = format!("unsupported `{}` syntax", env_name); if strpbrk(&proxy_url, "\r\n\t").is_some() { - return Err(RuntimeException { message: syntax_error, code: 0 }); + return Err(RuntimeException { + message: syntax_error, + code: 0, + }); } let proxy_parsed = parse_url_all(&proxy_url); let proxy = match proxy_parsed.as_array() { - None => return Err(RuntimeException { message: syntax_error, code: 0 }), + None => { + return Err(RuntimeException { + message: syntax_error, + code: 0, + }); + } Some(a) => a.clone(), }; @@ -37,7 +45,10 @@ impl ProxyItem { } let scheme = if proxy.contains_key("scheme") { - format!("{}://", proxy["scheme"].as_string().unwrap_or("").to_lowercase()) + format!( + "{}://", + proxy["scheme"].as_string().unwrap_or("").to_lowercase() + ) } else { "http://".to_string() }; @@ -92,13 +103,13 @@ impl ProxyItem { return Err(RuntimeException { message: format!("unable to find proxy port in {}", env_name), code: 0, - }) + }); } Some(0) => { return Err(RuntimeException { message: format!("port 0 is reserved in {}", env_name), code: 0, - }) + }); } Some(p) => p, }; |
