[web-downloads] main: Remove redundant curl_close calls
Author: Shivam Mathur (shivammathur)
Date: 2026-10-02T18:54:13+05:30
Commit: https://github.com/php/web-downloads/commit/a115e47b40d587422b51dde112b45e6c006c1318
Raw diff: https://github.com/php/web-downloads/commit/a115e47b40d587422b51dde112b45e6c006c1318.diff
Remove redundant curl_close calls
Changed paths:
M src/Actions/FetchArtifact.php
M src/Actions/GetArtifacts.php
Diff:
diff --git a/src/Actions/FetchArtifact.php b/src/Actions/FetchArtifact.php
index cfcf535..46da4f6 100644
--- a/src/Actions/FetchArtifact.php
+++ b/src/Actions/FetchArtifact.php
@@ -52,7 +52,6 @@ private function download($url, $filepath, #[SensitiveParameter] $token): void
$error = curl_error($ch);
$httpCode = (int) curl_getinfo($ch, CURLINFO_HTTP_CODE);
fclose($fp);
- curl_close($ch);
if ($result === false) {
@unlink($filepath);
@@ -96,7 +95,6 @@ private function getRangeDownloadSize($url, #[SensitiveParameter] $token): ?int
$result = curl_exec($ch);
$httpCode = (int) curl_getinfo($ch, CURLINFO_HTTP_CODE);
- curl_close($ch);
return $result !== false && $httpCode === 206 && $size > 0 ? $size :
null;
}
@@ -162,7 +160,6 @@ private function downloadInParallel(
$result = curl_multi_add_handle($multiHandle, $handle);
if ($result !== CURLM_OK) {
fclose($stream);
- curl_close($handle);
throw new RuntimeException('Failed to start an artifact range');
}
@@ -199,7 +196,6 @@ private function downloadInParallel(
} finally {
foreach ($downloads as $download) {
curl_multi_remove_handle($multiHandle, $download['handle']);
- curl_close($download['handle']);
fclose($download['stream']);
}
diff --git a/src/Actions/GetArtifacts.php b/src/Actions/GetArtifacts.php
index e2f753d..79927f1 100644
--- a/src/Actions/GetArtifacts.php
+++ b/src/Actions/GetArtifacts.php
@@ -29,7 +29,6 @@ public function handle($workflow_run_id, #[SensitiveParameter] $token): void
$response = curl_exec($ch);
$err = curl_error($ch);
- curl_close($ch);
if ($err) {
echo "cURL Error #:" . $err;
Thread (1 message)
- Shivam Mathur