mirror of
https://github.com/friendica/friendica
synced 2025-04-20 17:10:10 +00:00
Improved check for invalid certificates
This commit is contained in:
parent
896fd3fc91
commit
abe3fd7605
4 changed files with 25 additions and 41 deletions
|
@ -68,6 +68,13 @@ class HttpClient implements ICanSendHttpRequests
|
|||
$this->profiler->startRecording('network');
|
||||
$this->logger->debug('Request start.', ['url' => $url, 'method' => $method]);
|
||||
|
||||
$host = parse_url($url, PHP_URL_HOST);
|
||||
if(!filter_var($host, FILTER_VALIDATE_IP) && !@dns_get_record($host . '.', DNS_A + DNS_AAAA)) {
|
||||
$this->logger->debug('URL cannot be resolved.', ['url' => $url, 'callstack' => System::callstack(20)]);
|
||||
$this->profiler->stopRecording();
|
||||
return CurlResult::createErrorCurl($url);
|
||||
}
|
||||
|
||||
if (Network::isLocalLink($url)) {
|
||||
$this->logger->info('Local link', ['url' => $url, 'callstack' => System::callstack(20)]);
|
||||
}
|
||||
|
@ -125,6 +132,10 @@ class HttpClient implements ICanSendHttpRequests
|
|||
$conf[RequestOptions::TIMEOUT] = $opts[HttpClientOptions::TIMEOUT];
|
||||
}
|
||||
|
||||
if (isset($opts[HttpClientOptions::VERIFY])) {
|
||||
$conf[RequestOptions::VERIFY] = $opts[HttpClientOptions::VERIFY];
|
||||
}
|
||||
|
||||
if (!empty($opts[HttpClientOptions::BODY])) {
|
||||
$conf[RequestOptions::BODY] = $opts[HttpClientOptions::BODY];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue