Store the network profiler data
This commit is contained in:
parent
1414d43597
commit
e22bb32247
1 changed files with 7 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue