aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/util/remote_filesystem.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-03 20:10:17 +0900
committernsfisis <nsfisis@gmail.com>2026-06-03 20:10:17 +0900
commiteacd2abcc53659a9fa20b1274a30ac4d9ad8bdb6 (patch)
tree22affc2abef924f4f8bbe7ccec920689c9c01783 /crates/shirabe/src/util/remote_filesystem.rs
parent26daafaae3713cd94ce32354e6404d95e06c568c (diff)
downloadphp-shirabe-eacd2abcc53659a9fa20b1274a30ac4d9ad8bdb6.tar.gz
php-shirabe-eacd2abcc53659a9fa20b1274a30ac4d9ad8bdb6.tar.zst
php-shirabe-eacd2abcc53659a9fa20b1274a30ac4d9ad8bdb6.zip
feat(php-shim): align fwrite/touch2/PHP_OS_FAMILY/PHP_URL_SCHEME with PHP
Adjust fwrite to return int|false equivalent (Option<i64>), add touch2 with mtime, implement PHP_OS_FAMILY via std::env::consts::OS, and swap the PHP_URL_HOST placeholders for the now-available PHP_URL_SCHEME. Wire these into locker, filesystem, platform, and remote_filesystem. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/util/remote_filesystem.rs')
-rw-r--r--crates/shirabe/src/util/remote_filesystem.rs9
1 files changed, 3 insertions, 6 deletions
diff --git a/crates/shirabe/src/util/remote_filesystem.rs b/crates/shirabe/src/util/remote_filesystem.rs
index 22f5ea2..2773300 100644
--- a/crates/shirabe/src/util/remote_filesystem.rs
+++ b/crates/shirabe/src/util/remote_filesystem.rs
@@ -4,7 +4,7 @@ use indexmap::IndexMap;
use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
use shirabe_php_shim::{
- FILTER_VALIDATE_BOOLEAN, PHP_URL_HOST, PHP_URL_PATH, PHP_VERSION_ID, PhpMixed,
+ FILTER_VALIDATE_BOOLEAN, PHP_URL_HOST, PHP_URL_PATH, PHP_URL_SCHEME, PHP_VERSION_ID, PhpMixed,
RuntimeException, STREAM_NOTIFY_FAILURE, STREAM_NOTIFY_FILE_SIZE_IS, STREAM_NOTIFY_PROGRESS,
array_replace_recursive, base64_encode, explode, extension_loaded, file_put_contents,
filter_var, gethostbyname, http_clear_last_response_headers, http_get_last_response_headers,
@@ -177,8 +177,7 @@ impl RemoteFilesystem {
file_name: Option<String>,
progress: bool,
) -> anyhow::Result<GetResult> {
- // TODO(phase-b): PHP_URL_SCHEME constant isn't yet in the shim; PHP_URL_HOST stands in.
- self.scheme = parse_url(&strtr(file_url, "\\", "/"), PHP_URL_HOST)
+ self.scheme = parse_url(&strtr(file_url, "\\", "/"), PHP_URL_SCHEME)
.as_string()
.unwrap_or("")
.to_string();
@@ -928,12 +927,10 @@ impl RemoteFilesystem {
) -> anyhow::Result<Option<String>> {
let mut target_url: Option<String> = None;
if let Some(location_header) = Response::find_header_value(response_headers, "location") {
- // TODO(phase-b): use PHP_URL_SCHEME once available to detect absolute URLs.
- if !parse_url(&location_header, PHP_URL_HOST)
+ if !parse_url(&location_header, PHP_URL_SCHEME)
.as_string()
.unwrap_or("")
.is_empty()
- && location_header.contains("://")
{
target_url = Some(location_header);
} else if parse_url(&location_header, PHP_URL_HOST)