1
1
Fork 0

Merge pull request #9025 from annando/timeout-loop

Avoid loop situations and connection timeouts
This commit is contained in:
Tobias Diekershoff 2020-08-18 10:22:38 +02:00 committed by GitHub
commit a8431584ba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View file

@ -166,7 +166,7 @@ class Relation
}
if (empty($contact)) {
$contact = Contact::getByURL($url);
$contact = Contact::getByURL($url, false);
}
if (empty($contact)) {

View file

@ -137,6 +137,8 @@ class HTTPRequest implements IHTTPRequest
@curl_setopt($ch, CURLOPT_NOBODY, $opts['nobody']);
}
@curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
if (!empty($opts['timeout'])) {
@curl_setopt($ch, CURLOPT_TIMEOUT, $opts['timeout']);
} else {
@ -238,6 +240,8 @@ class HTTPRequest implements IHTTPRequest
curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
}
@curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
if (intval($timeout)) {
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
} else {
@ -331,6 +335,7 @@ class HTTPRequest implements IHTTPRequest
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_NOBODY, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, $this->getUserAgent());
@ -375,6 +380,7 @@ class HTTPRequest implements IHTTPRequest
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_NOBODY, 0);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, $this->getUserAgent());