Browse Source

Avoid loop situations and connection timeouts

pull/9025/head
Michael 11 months ago
parent
commit
998c83eacb
2 changed files with 7 additions and 1 deletions
  1. +1
    -1
      src/Model/Contact/Relation.php
  2. +6
    -0
      src/Network/HTTPRequest.php

+ 1
- 1
src/Model/Contact/Relation.php View File

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


+ 6
- 0
src/Network/HTTPRequest.php 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());


Loading…
Cancel
Save