Merge commit 'e38866c4ba90f8efd5630dbe674fd7ca15f586ff'

This commit is contained in:
Dylan K. Taylor
2021-10-12 23:23:27 +01:00
5 changed files with 65 additions and 30 deletions

View File

@ -218,8 +218,8 @@ class Internet{
throw new InternetException(curl_error($ch));
}
if(!is_string($raw)) throw new AssumptionFailedError("curl_exec() should return string|false when CURLOPT_RETURNTRANSFER is set");
/** @var int $httpCode */
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if(!is_int($httpCode)) throw new AssumptionFailedError("curl_getinfo(CURLINFO_HTTP_CODE) always returns int");
$headerSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
$rawHeaders = substr($raw, 0, $headerSize);
$body = substr($raw, $headerSize);