simplify and add tests for upload (and replace) path

This commit is contained in:
Shish
2020-10-28 20:51:34 +00:00
parent 7cb18568e3
commit 3f5930b4cb
9 changed files with 262 additions and 219 deletions

View File

@@ -252,7 +252,7 @@ function load_balance_url(string $tmpl, string $hash, int $n=0): string
return $tmpl;
}
function transload(string $url, string $mfile): ?array
function fetch_url(string $url, string $mfile): ?array
{
global $config;
@@ -269,8 +269,7 @@ function transload(string $url, string $mfile): ?array
$response = curl_exec($ch);
if ($response === false) {
log_warning("core-util", "Failed to transload $url");
throw new SCoreException("Failed to fetch $url");
return null;
}
$header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);