From e22bb3224799a7b25f0d4c0dabae17da9af58d2e Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 17 Dec 2020 06:23:03 +0000 Subject: [PATCH] Store the network profiler data --- src/Network/HTTPRequest.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Network/HTTPRequest.php b/src/Network/HTTPRequest.php index a0d940414e..0aab36142f 100644 --- a/src/Network/HTTPRequest.php +++ b/src/Network/HTTPRequest.php @@ -76,6 +76,7 @@ class HTTPRequest implements IHTTPRequest if (strlen($url) > 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); } @@ -201,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); } @@ -224,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); } @@ -289,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); }