From f5f429dbae0a3e2d8224c0b1e4edcef54805d286 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Thu, 25 Jun 2026 16:44:29 +0900 Subject: feat(http): reimplement CurlDownloader on reqwest; port 15 more tests Replace the libcurl-shim CurlDownloader with a reqwest+tokio implementation per the .ken sketch, resolving the construction panic that blocked command tests (mock path via __new_mock is untouched). Port remote_filesystem (7), hg/svn driver (4), zip_archiver/git_exclude_filter (4) tests. Fix hg/svn/git_exclude regex-delimiter and svn result-propagation porting bugs. Co-Authored-By: Claude Opus 4.8 (1M context) --- crates/shirabe/src/util/http_downloader.rs | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'crates/shirabe/src/util/http_downloader.rs') diff --git a/crates/shirabe/src/util/http_downloader.rs b/crates/shirabe/src/util/http_downloader.rs index 782f04a..9057899 100644 --- a/crates/shirabe/src/util/http_downloader.rs +++ b/crates/shirabe/src/util/http_downloader.rs @@ -557,20 +557,19 @@ impl HttpDownloader { } // curl branch: register the request with the curl multi handle. Completion is delivered - // asynchronously by curl.tick() into the job's `settled` slot (read by count_active_jobs). - // PHP catches any exception from download() and rejects the job. + // by curl.tick() into the job's `settled` slot (read by count_active_jobs). The resolve + // callback stores the Response, reject stores the error; this mirrors PHP's promise + // resolve/reject firing during tick(). PHP catches any exception from download() and + // rejects the job. let settled = self.jobs.get(&id).unwrap().settled.clone(); let settled_for_reject = settled.clone(); - let resolve: Box = Box::new(move |_response: PhpMixed| { - // TODO(phase-c-promise): curl.tick() delivers the response as PhpMixed here; convert it - // into a Response and store Ok(..) in `settled`. Bottoms at the todo!() curl I/O. - let _ = &settled; - }); - let reject: Box = Box::new(move |_error: PhpMixed| { - // TODO(phase-c-promise): convert the PhpMixed error into anyhow::Error and store - // Err(..) in `settled`. Bottoms at the todo!() curl I/O. - let _ = &settled_for_reject; + let resolve: Box = Box::new(move |response: Response| { + *settled.lock().unwrap() = Some(Ok(response)); }); + let reject: Box = + Box::new(move |error: anyhow::Error| { + *settled_for_reject.lock().unwrap() = Some(Err(error)); + }); let download_result = { let curl = self.curl.as_mut().unwrap(); -- cgit v1.3.1