]> git.mxchange.org Git - friendica.git/commitdiff
Avoid loop situations and connection timeouts
authorMichael <heluecht@pirati.ca>
Tue, 18 Aug 2020 03:55:27 +0000 (03:55 +0000)
committerMichael <heluecht@pirati.ca>
Tue, 18 Aug 2020 03:55:27 +0000 (03:55 +0000)
src/Model/Contact/Relation.php
src/Network/HTTPRequest.php

index d1e51811ff8fce5a777a6b36ff6a68966ca73a0d..80092e03886c4fae5e20841e7e41a23c022a7d5c 100644 (file)
@@ -166,7 +166,7 @@ class Relation
                }
 
                if (empty($contact)) {
-                       $contact = Contact::getByURL($url);
+                       $contact = Contact::getByURL($url, false);
                }
 
                if (empty($contact)) {
index 6fcd610aadbae797fc00d6c535740d29528a0bbb..79419d38e25fbe581504ce2e963e6e68f1354e7f 100644 (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());