Skip to content

Commit

Permalink
Always use ms scaled timeouts (#1785)
Browse files Browse the repository at this point in the history
  • Loading branch information
stayallive authored Nov 5, 2024
1 parent af7955a commit 93f0673
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions src/HttpClient/HttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,27 +64,15 @@ public function sendRequest(Request $request, Options $options): Response
curl_setopt($curlHandle, \CURLOPT_URL, $dsn->getEnvelopeApiEndpointUrl());
curl_setopt($curlHandle, \CURLOPT_HTTPHEADER, $requestHeaders);
curl_setopt($curlHandle, \CURLOPT_USERAGENT, $this->sdkIdentifier . '/' . $this->sdkVersion);
curl_setopt($curlHandle, \CURLOPT_TIMEOUT_MS, $options->getHttpTimeout() * 1000);
curl_setopt($curlHandle, \CURLOPT_CONNECTTIMEOUT_MS, $options->getHttpConnectTimeout() * 1000);
curl_setopt($curlHandle, \CURLOPT_ENCODING, '');
curl_setopt($curlHandle, \CURLOPT_POST, true);
curl_setopt($curlHandle, \CURLOPT_POSTFIELDS, $requestData);
curl_setopt($curlHandle, \CURLOPT_RETURNTRANSFER, true);
curl_setopt($curlHandle, \CURLOPT_HEADERFUNCTION, $responseHeaderCallback);
curl_setopt($curlHandle, \CURLOPT_HTTP_VERSION, \CURL_HTTP_VERSION_1_1);

$httpTimeout = $options->getHttpTimeout();
if ($httpTimeout < 1.0) {
curl_setopt($curlHandle, \CURLOPT_TIMEOUT_MS, $httpTimeout * 1000);
} else {
curl_setopt($curlHandle, \CURLOPT_TIMEOUT, $httpTimeout);
}

$connectTimeout = $options->getHttpConnectTimeout();
if ($connectTimeout < 1.0) {
curl_setopt($curlHandle, \CURLOPT_CONNECTTIMEOUT_MS, $connectTimeout * 1000);
} else {
curl_setopt($curlHandle, \CURLOPT_CONNECTTIMEOUT, $connectTimeout);
}

$httpSslVerifyPeer = $options->getHttpSslVerifyPeer();
if (!$httpSslVerifyPeer) {
curl_setopt($curlHandle, \CURLOPT_SSL_VERIFYPEER, false);
Expand Down

0 comments on commit 93f0673

Please sign in to comment.