curl usage: support HTTP/2 response code header

This commit is contained in:
ArthurHoaro 2021-01-19 15:03:18 +01:00
parent ffa39719a1
commit 6b76ce6f62

View file

@ -37,7 +37,7 @@ public static function getLatestGitVersionCode($url, $timeout = 2)
{
list($headers, $data) = get_http_response($url, $timeout);
if (strpos($headers[0], '200 OK') === false) {
if (preg_match('#HTTP/[\d\.]+ 200(?: OK)?#', $headers[0]) !== 1) {
error_log('Failed to retrieve ' . $url);
return false;
}