@@ -348,9 +348,9 @@ void SetupDns(CURL* curl_handle, const std::vector<std::string>& dns_servers) {
348
348
#endif
349
349
}
350
350
351
- Diagnostics GetDiagnostics (CURL* handle) {
351
+ void WithDiagnostics (NetworkResponse& response, CURL* handle) {
352
+ #if CURL_AT_LEAST_VERSION(7, 61, 0)
352
353
Diagnostics diagnostics;
353
-
354
354
static const std::pair<Diagnostics::Timings, CURLINFO> available_timings[] = {
355
355
#if CURL_AT_LEAST_VERSION(8, 6, 0)
356
356
{Diagnostics::Queue, CURLINFO_QUEUE_TIME_T},
@@ -388,7 +388,10 @@ Diagnostics GetDiagnostics(CURL* handle) {
388
388
389
389
add_timing (Diagnostics::Total, Diagnostics::MicroSeconds (last_time_point));
390
390
391
- return diagnostics;
391
+ response.WithDiagnostics (diagnostics);
392
+ #else
393
+ OLP_SDK_CORE_UNUSED (response, handle);
394
+ #endif
392
395
}
393
396
394
397
} // anonymous namespace
@@ -1047,8 +1050,9 @@ void NetworkCurl::CompleteMessage(CURL* curl_handle, CURLcode result) {
1047
1050
auto response = NetworkResponse ()
1048
1051
.WithRequestId (request_handle->id )
1049
1052
.WithBytesDownloaded (download_bytes)
1050
- .WithBytesUploaded (upload_bytes)
1051
- .WithDiagnostics (GetDiagnostics (curl_handle));
1053
+ .WithBytesUploaded (upload_bytes);
1054
+
1055
+ WithDiagnostics (response, curl_handle);
1052
1056
1053
1057
if (request_handle->is_cancelled ) {
1054
1058
response.WithStatus (static_cast <int >(ErrorCode::CANCELLED_ERROR))
@@ -1243,8 +1247,9 @@ void NetworkCurl::Run() {
1243
1247
.WithStatus (static_cast <int >(ErrorCode::IO_ERROR))
1244
1248
.WithError (" CURL error" )
1245
1249
.WithBytesDownloaded (download_bytes)
1246
- .WithBytesUploaded (upload_bytes)
1247
- .WithDiagnostics (GetDiagnostics (curl_handle));
1250
+ .WithBytesUploaded (upload_bytes);
1251
+
1252
+ WithDiagnostics (response, curl_handle);
1248
1253
1249
1254
callback (response);
1250
1255
lock.lock ();
0 commit comments