[sr-dev] git:master:632380ff: http_client: move assign for download size after right side variable was set

Daniel-Constantin Mierla miconda at gmail.com
Sat Jul 1 09:11:41 CEST 2017


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2017-07-01T09:11:12+02:00

http_client: move assign for download size after right side variable was set

---

Modified: src/modules/http_client/functions.c

---

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

---

diff --git a/src/modules/http_client/functions.c b/src/modules/http_client/functions.c
index f1a148748f..ea194250ed 100644
--- a/src/modules/http_client/functions.c
+++ b/src/modules/http_client/functions.c
@@ -114,9 +114,9 @@ static int curL_query_url(struct sip_msg* _m, const char* _url, str* _dst,
 	CURLcode res;
 	char *at = NULL;
 	curl_res_stream_t stream;
-	long stat;
-	str rval;
-	double download_size;
+	long stat = 0;
+	str rval = STR_NULL;
+	double download_size = 0;
 	struct curl_slist *headerlist = NULL;
 
 	memset(&stream, 0, sizeof(curl_res_stream_t));
@@ -360,10 +360,11 @@ static int curL_query_url(struct sip_msg* _m, const char* _url, str* _dst,
 	}
 
 	if ((stat >= 200) && (stat < 500)) {
-		double datasize = download_size;
+		double datasize = 0;
 
 		curl_easy_getinfo(curl, CURLINFO_SIZE_DOWNLOAD, &download_size);
 		LM_DBG("  -- curl download size: %u \n", (unsigned int)download_size);
+		datasize = download_size;
 
 		if (download_size > 0) {
 




More information about the sr-dev mailing list