Skip to content

Commit

Permalink
rest_client: Fix RHEL 7.9 build regression in commit 7e85fdd
Browse files Browse the repository at this point in the history
RHEL 7.9 is using libcurl 7.29 (from 11 years ago), so the
CURLINFO_CONNECT_TIME_T easyinfo option is not available.  So let's use
the CURLINFO_CONNECT_TIME info instead, which returns the exact same
data (i.e. the `data->progress.t_connect` handle info), but divided as
(double)seconds instead of being returned as (long)useconds.

Credits to Răzvan Crainea for reporting this issue!
  • Loading branch information
liviuchircu committed Mar 8, 2024
1 parent fcfacae commit 975f5d1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions modules/rest_client/rest_methods.c
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,7 @@ int start_async_http_req(struct sip_msg *msg, enum rest_client_method method,

/* obtain a read fd in "connection_timeout" seconds at worst */
for (timeout = connect_timeout; timeout > 0; timeout -= busy_wait) {
curl_off_t connect = -1;
double connect = -1;
long req_sz = -1;

mrc = curl_multi_perform(multi_handle, &running_handles);
Expand All @@ -907,11 +907,11 @@ int start_async_http_req(struct sip_msg *msg, enum rest_client_method method,
goto error;
}

curl_easy_getinfo(handle, CURLINFO_CONNECT_TIME_T, &connect);
curl_easy_getinfo(handle, CURLINFO_CONNECT_TIME, &connect);
curl_easy_getinfo(handle, CURLINFO_REQUEST_SIZE, &req_sz);

LM_DBG("perform code: %d, handles: %d, connect: %ldµs, reqsz: %ldB\n",
mrc, running_handles, (long)connect, req_sz);
LM_DBG("perform code: %d, handles: %d, connect: %.3lfs, reqsz: %ldB\n",
mrc, running_handles, connect, req_sz);

/* transfer completed! But how well? */
if (running_handles == 0) {
Expand Down

0 comments on commit 975f5d1

Please sign in to comment.