Module: kamailio
Branch: master
Commit: b7b3c67fc1205d114fadf360a594930ef69835a3
URL: 
https://github.com/kamailio/kamailio/commit/b7b3c67fc1205d114fadf360a594930ef69835a3

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2023-06-21T09:27:28+02:00

http_client: fix depecration of CURLOPT_PROTOCOLS and CURLINFO_SIZE_DOWNLOAD

- GH #3484

---

Modified: src/modules/http_client/functions.c

---

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

---

diff --git a/src/modules/http_client/functions.c 
b/src/modules/http_client/functions.c
index e85d87d6938..a5316972d45 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