X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FNetwork%2FHTTPRequest.php;h=74cf9cd0554d01a62beb0a1486b391bb734f4f69;hb=befc2af5043a3afde251721c0d27df695db1bb7e;hp=df62ea45446f696bd076e53b2149ed8685488687;hpb=61da51c2d51342bb338cba67191b50442488eeb3;p=friendica.git diff --git a/src/Network/HTTPRequest.php b/src/Network/HTTPRequest.php index df62ea4544..74cf9cd055 100644 --- a/src/Network/HTTPRequest.php +++ b/src/Network/HTTPRequest.php @@ -1,6 +1,6 @@ 1000) { $this->logger->debug('URL is longer than 1000 characters.', ['url' => $url, 'callstack' => System::callstack(20)]); + $this->profiler->saveTimestamp($stamp1, 'network'); return CurlResult::createErrorCurl(substr($url, 0, 200)); } @@ -94,12 +95,14 @@ class HTTPRequest implements IHTTPRequest if (Network::isUrlBlocked($url)) { $this->logger->info('Domain is blocked.', ['url' => $url]); + $this->profiler->saveTimestamp($stamp1, 'network'); return CurlResult::createErrorCurl($url); } $ch = @curl_init($url); if (($redirects > 8) || (!$ch)) { + $this->profiler->saveTimestamp($stamp1, 'network'); return CurlResult::createErrorCurl($url); } @@ -141,6 +144,7 @@ class HTTPRequest implements IHTTPRequest curl_setopt($ch, CURLOPT_ENCODING, ''); if (!empty($opts['headers'])) { + $this->logger->notice('Wrong option \'headers\' used.'); @curl_setopt($ch, CURLOPT_HTTPHEADER, $opts['headers']); } @@ -183,8 +187,6 @@ class HTTPRequest implements IHTTPRequest curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); } - $logger = $this->logger; - $s = @curl_exec($ch); $curl_info = @curl_getinfo($ch); @@ -202,6 +204,7 @@ class HTTPRequest implements IHTTPRequest $redirects++; $this->logger->notice('Curl redirect.', ['url' => $url, 'to' => $curlResponse->getRedirectUrl()]); @curl_close($ch); + $this->profiler->saveTimestamp($stamp1, 'network'); return $this->get($curlResponse->getRedirectUrl(), $opts, $redirects); } @@ -225,12 +228,14 @@ class HTTPRequest implements IHTTPRequest if (Network::isUrlBlocked($url)) { $this->logger->info('Domain is blocked.' . ['url' => $url]); + $this->profiler->saveTimestamp($stamp1, 'network'); return CurlResult::createErrorCurl($url); } $ch = curl_init($url); if (($redirects > 8) || (!$ch)) { + $this->profiler->saveTimestamp($stamp1, 'network'); return CurlResult::createErrorCurl($url); } @@ -290,6 +295,7 @@ class HTTPRequest implements IHTTPRequest $redirects++; $this->logger->info('Post redirect.', ['url' => $url, 'to' => $curlResponse->getRedirectUrl()]); curl_close($ch); + $this->profiler->saveTimestamp($stamp1, 'network'); return $this->post($curlResponse->getRedirectUrl(), $params, $headers, $redirects, $timeout); }