aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/util/http
diff options
context:
space:
mode:
Diffstat (limited to 'crates/shirabe/src/util/http')
-rw-r--r--crates/shirabe/src/util/http/curl_downloader.rs40
-rw-r--r--crates/shirabe/src/util/http/curl_response.rs2
-rw-r--r--crates/shirabe/src/util/http/mod.rs7
-rw-r--r--crates/shirabe/src/util/http/proxy_item.rs2
-rw-r--r--crates/shirabe/src/util/http/proxy_manager.rs8
-rw-r--r--crates/shirabe/src/util/http/request_proxy.rs2
-rw-r--r--crates/shirabe/src/util/http/response.rs10
7 files changed, 39 insertions, 32 deletions
diff --git a/crates/shirabe/src/util/http/curl_downloader.rs b/crates/shirabe/src/util/http/curl_downloader.rs
index fd46220..bd6817c 100644
--- a/crates/shirabe/src/util/http/curl_downloader.rs
+++ b/crates/shirabe/src/util/http/curl_downloader.rs
@@ -4,7 +4,7 @@ use std::sync::atomic::{AtomicBool, Ordering};
use indexmap::IndexMap;
-use shirabe_external_packages::composer::pcre::preg::Preg;
+use shirabe_external_packages::composer::pcre::Preg;
use shirabe_php_shim::{
CURL_HTTP_VERSION_2_0, CURL_HTTP_VERSION_3, CURL_IPRESOLVE_V4, CURL_IPRESOLVE_V6,
CURL_LOCK_DATA_COOKIE, CURL_LOCK_DATA_DNS, CURL_LOCK_DATA_SSL_SESSION, CURL_VERSION_HTTP2,
@@ -26,17 +26,17 @@ use shirabe_php_shim::{
};
use crate::config::Config;
-use crate::downloader::max_file_size_exceeded_exception::MaxFileSizeExceededException;
-use crate::downloader::transport_exception::TransportException;
-use crate::io::io_interface::IOInterface;
-use crate::util::auth_helper::{AuthHelper, PromptAuthResult, StoreAuth};
-use crate::util::http::curl_response::CurlResponse;
-use crate::util::http::proxy_manager::ProxyManager;
-use crate::util::http_downloader::HttpDownloader;
-use crate::util::platform::Platform;
-use crate::util::stream_context_factory::StreamContextFactory;
-use crate::util::url::Url;
-// use shirabe_external_packages::react::promise::promise::Promise; // typehint only in PHP
+use crate::downloader::MaxFileSizeExceededException;
+use crate::downloader::TransportException;
+use crate::io::IOInterface;
+use crate::util::HttpDownloader;
+use crate::util::Platform;
+use crate::util::StreamContextFactory;
+use crate::util::Url;
+use crate::util::http::CurlResponse;
+use crate::util::http::ProxyManager;
+use crate::util::{AuthHelper, PromptAuthResult, StoreAuth};
+// use shirabe_external_packages::react::promise::Promise; // typehint only in PHP
/// @phpstan-type Attributes array{retryAuthFailure: bool, redirects: int<0, max>, retries: int<0, max>, storeAuth: 'prompt'|bool, ipResolve: 4|6|null}
/// @phpstan-type Job array{url: non-empty-string, origin: string, attributes: Attributes, options: mixed[], progress: mixed[], curlHandle: \CurlHandle, filename: string|null, headerHandle: resource, bodyHandle: resource, resolve: callable, reject: callable, primaryIp: string}
@@ -699,7 +699,7 @@ impl CurlDownloader {
if_modified
),
true,
- crate::io::io_interface::DEBUG,
+ crate::io::DEBUG,
);
}
@@ -843,7 +843,7 @@ impl CurlDownloader {
self.io.write_error3(
"<warning>A connection timeout was encountered. If you intend to run Composer without connecting to the internet, run the command again prefixed with COMPOSER_DISABLE_NETWORK=1 to make Composer run in offline mode.</warning>",
true,
- crate::io::io_interface::NORMAL,
+ crate::io::NORMAL,
);
}
@@ -929,7 +929,7 @@ impl CurlDownloader {
errno
),
true,
- crate::io::io_interface::DEBUG,
+ crate::io::DEBUG,
);
self.restart_job_with_delay(
&job,
@@ -961,7 +961,7 @@ impl CurlDownloader {
errno
),
true,
- crate::io::io_interface::DEBUG,
+ crate::io::DEBUG,
);
let mut attrs: IndexMap<String, PhpMixed> = IndexMap::new();
attrs.insert(
@@ -1095,7 +1095,7 @@ impl CurlDownloader {
)
),
true,
- crate::io::io_interface::DEBUG,
+ crate::io::DEBUG,
);
} else {
let max_file_size: Option<i64> = job
@@ -1174,7 +1174,7 @@ impl CurlDownloader {
)
),
true,
- crate::io::io_interface::DEBUG,
+ crate::io::DEBUG,
);
}
fclose(job.get("bodyHandle").cloned().unwrap_or(PhpMixed::Null));
@@ -1323,7 +1323,7 @@ impl CurlDownloader {
sc
),
true,
- crate::io::io_interface::DEBUG,
+ crate::io::DEBUG,
);
let mut attrs: IndexMap<String, PhpMixed> = IndexMap::new();
attrs.insert(
@@ -1632,7 +1632,7 @@ impl CurlDownloader {
],
),
true,
- crate::io::io_interface::DEBUG,
+ crate::io::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 c6f5d77..9f330b6 100644
--- a/crates/shirabe/src/util/http/curl_response.rs
+++ b/crates/shirabe/src/util/http/curl_response.rs
@@ -3,7 +3,7 @@
use indexmap::IndexMap;
use shirabe_php_shim::PhpMixed;
-use super::response::Response;
+use super::Response;
#[derive(Debug)]
pub struct CurlResponse {
diff --git a/crates/shirabe/src/util/http/mod.rs b/crates/shirabe/src/util/http/mod.rs
index 4ee97c5..19e5a86 100644
--- a/crates/shirabe/src/util/http/mod.rs
+++ b/crates/shirabe/src/util/http/mod.rs
@@ -4,3 +4,10 @@ pub mod proxy_item;
pub mod proxy_manager;
pub mod request_proxy;
pub mod response;
+
+pub use curl_downloader::*;
+pub use curl_response::*;
+pub use proxy_item::*;
+pub use proxy_manager::*;
+pub use request_proxy::*;
+pub use response::*;
diff --git a/crates/shirabe/src/util/http/proxy_item.rs b/crates/shirabe/src/util/http/proxy_item.rs
index db71476..1a0b3ee 100644
--- a/crates/shirabe/src/util/http/proxy_item.rs
+++ b/crates/shirabe/src/util/http/proxy_item.rs
@@ -1,6 +1,6 @@
//! ref: composer/src/Composer/Util/Http/ProxyItem.php
-use crate::util::http::request_proxy::RequestProxy;
+use crate::util::http::RequestProxy;
use indexmap::IndexMap;
use shirabe_php_shim::{
PhpMixed, RuntimeException, base64_encode, parse_url_all, rawurldecode, strpbrk,
diff --git a/crates/shirabe/src/util/http/proxy_manager.rs b/crates/shirabe/src/util/http/proxy_manager.rs
index 13a9920..eac3cb2 100644
--- a/crates/shirabe/src/util/http/proxy_manager.rs
+++ b/crates/shirabe/src/util/http/proxy_manager.rs
@@ -2,10 +2,10 @@
use std::sync::{Mutex, OnceLock};
-use crate::downloader::transport_exception::TransportException;
-use crate::util::http::proxy_item::ProxyItem;
-use crate::util::http::request_proxy::RequestProxy;
-use crate::util::no_proxy_pattern::NoProxyPattern;
+use crate::downloader::TransportException;
+use crate::util::NoProxyPattern;
+use crate::util::http::ProxyItem;
+use crate::util::http::RequestProxy;
static INSTANCE: OnceLock<Mutex<Option<ProxyManager>>> = OnceLock::new();
diff --git a/crates/shirabe/src/util/http/request_proxy.rs b/crates/shirabe/src/util/http/request_proxy.rs
index a85e283..876b8cc 100644
--- a/crates/shirabe/src/util/http/request_proxy.rs
+++ b/crates/shirabe/src/util/http/request_proxy.rs
@@ -7,7 +7,7 @@ use shirabe_php_shim::{
PhpMixed, curl_version,
};
-use crate::downloader::transport_exception::TransportException;
+use crate::downloader::TransportException;
// contextOptions = array{http: array{proxy: string, header?: string, request_fulluri?: bool}}
type ContextOptions = IndexMap<String, IndexMap<String, PhpMixed>>;
diff --git a/crates/shirabe/src/util/http/response.rs b/crates/shirabe/src/util/http/response.rs
index ef86ec9..a2bc0f1 100644
--- a/crates/shirabe/src/util/http/response.rs
+++ b/crates/shirabe/src/util/http/response.rs
@@ -1,8 +1,8 @@
//! ref: composer/src/Composer/Util/Http/Response.php
-use crate::json::json_file::JsonFile;
+use crate::json::JsonFile;
use indexmap::IndexMap;
-use shirabe_external_packages::composer::pcre::preg::Preg;
+use shirabe_external_packages::composer::pcre::Preg;
use shirabe_php_shim::{LogicException, PhpMixed, preg_quote};
#[derive(Debug)]
@@ -83,12 +83,12 @@ impl Response {
let pattern = format!("(?i)^{}:\\s*(.+?)\\s*$", preg_quote(name, None));
for header in headers {
let mut matches: indexmap::IndexMap<
- shirabe_external_packages::composer::pcre::preg::CaptureKey,
+ shirabe_external_packages::composer::pcre::CaptureKey,
String,
> = indexmap::IndexMap::new();
if Preg::match3(&pattern, header, Some(&mut matches)).unwrap_or(false) {
- if let Some(s) = matches
- .get(&shirabe_external_packages::composer::pcre::preg::CaptureKey::ByIndex(1))
+ if let Some(s) =
+ matches.get(&shirabe_external_packages::composer::pcre::CaptureKey::ByIndex(1))
{
value = Some(s.clone());
}