Module: kamailio
Branch: 5.7
Commit: 23a121e5d8ffa172f71433c2ef74f323a54e8315
URL: 
https://github.com/kamailio/kamailio/commit/23a121e5d8ffa172f71433c2ef74f323a54e8315

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Victor Seva <linuxman...@torreviejawireless.org>
Date: 2023-06-21T12:11:29+02:00

http_client: fix depecration of CURLOPT_PROTOCOLS and CURLINFO_SIZE_DOWNLOAD

- GH #3484

(cherry picked from commit b7b3c67fc1205d114fadf360a594930ef69835a3)

---

Modified: src/modules/http_client/functions.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/23a121e5d8ffa172f71433c2ef74f323a54e8315.diff
Patch: 
https://github.com/kamailio/kamailio/commit/23a121e5d8ffa172f71433c2ef74f323a54e8315.patch

---

diff --git a/src/modules/http_client/functions.c 
b/src/modules/http_client/functions.c
index 8a2b9938538..be0b2024b0d 100644
--- a/src/modules/http_client/functions.c
+++ b/src/modules/http_client/functions.c
@@ -155,8 +155,12 @@ static int curL_request_url(struct sip_msg *_m, const char 
*_met,
        res = curl_easy_setopt(curl, CURLOPT_URL, _url);
 
        /* Limit to HTTP and HTTPS protocols */
+#if defined(CURL_AT_LEAST_VERSION) && CURL_AT_LEAST_VERSION(7, 85, 0)
+       res = curl_easy_setopt(curl, CURLOPT_PROTOCOLS_STR, "http,https");
+#else
        res = curl_easy_setopt(
                        curl, CURLOPT_PROTOCOLS, CURLPROTO_HTTP | 
CURLPROTO_HTTPS);
+#endif
        res = curl_easy_setopt(
                        curl, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTP | 
CURLPROTO_HTTPS);
 
@@ -383,8 +387,13 @@ static int curL_request_url(struct sip_msg *_m, const char 
*_met,
 
        if((stat >= 200) && (stat < 500)) {
                double datasize = 0;
-
+#if defined(CURL_AT_LEAST_VERSION) && CURL_AT_LEAST_VERSION(7, 55, 0)
+               curl_off_t dlsize;
+               curl_easy_getinfo(curl, CURLINFO_SIZE_DOWNLOAD_T, &dlsize);
+               download_size = (double)dlsize;
+#else
                curl_easy_getinfo(curl, CURLINFO_SIZE_DOWNLOAD, &download_size);
+#endif
                LM_DBG("  -- curl download size: %u \n", (unsigned 
int)download_size);
                datasize = download_size;
 

_______________________________________________
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org

Reply via email to