A lot of Fixings
This commit is contained in:
@@ -145,4 +145,10 @@ class GuzzleResponse extends Response implements IHTTPResult, ResponseInterface
|
||||
{
|
||||
return $this->isTimeout;
|
||||
}
|
||||
|
||||
/// @todo - fix mismatching use of "getBody()" as string here and parent "getBody()" as streaminterface
|
||||
public function getBody()
|
||||
{
|
||||
return parent::getBody()->getContents();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ class HTTPRequest implements IHTTPRequest
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function get(string $url, bool $binary = false, array $opts = [])
|
||||
public function get(string $url, array $opts = [])
|
||||
{
|
||||
$this->profiler->startRecording('network');
|
||||
|
||||
@@ -193,10 +193,6 @@ class HTTPRequest implements IHTTPRequest
|
||||
$curlOptions[CURLOPT_IPRESOLVE] = CURL_IPRESOLVE_V4;
|
||||
}
|
||||
|
||||
if ($binary) {
|
||||
$curlOptions[CURLOPT_BINARYTRANSFER] = 1;
|
||||
}
|
||||
|
||||
$logger = $this->logger;
|
||||
|
||||
$onRedirect = function(
|
||||
@@ -223,7 +219,6 @@ class HTTPRequest implements IHTTPRequest
|
||||
'referer' => true,
|
||||
],
|
||||
'on_headers' => $onHeaders,
|
||||
'sink' => tempnam(get_temppath(), 'guzzle'),
|
||||
'curl' => $curlOptions
|
||||
]);
|
||||
|
||||
|
||||
@@ -424,16 +424,11 @@ class Probe
|
||||
*/
|
||||
private static function getHideStatus($url)
|
||||
{
|
||||
$curlResult = DI::httpRequest()->get($url, false, ['content_length' => 1000000]);
|
||||
$curlResult = DI::httpRequest()->get($url, ['content_length' => 1000000]);
|
||||
if (!$curlResult->isSuccess()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If the file is too large then exit
|
||||
if (($curlResult->getInfo()['download_content_length'] ?? 0) > 1000000) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If it isn't a HTML file then exit
|
||||
if (($curlResult->getContentType() != '') && !strstr(strtolower($curlResult->getContentType()), 'html')) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user