Browse code

http_client: do not set empty headers and body

(cherry picked from commit ce58411c462231d6ea1fc3b4acbf50520c2962ce)

Daniel-Constantin Mierla authored on 16/12/2020 19:54:57 • Henning Westerholt committed on 21/12/2020 15:31:08
Showing 1 changed files
... ...
@@ -891,8 +891,9 @@ static int ki_http_query_helper(sip_msg_t *_m, str *url, str *post, str *hdrs,
891 891
 		LM_ERR("invalid url parameter\n");
892 892
 		return -1;
893 893
 	}
894
-	ret = http_client_query(_m, url->s, &result, (post && post->s)?post->s:NULL,
895
-			(hdrs && hdrs->s)?hdrs->s:NULL);
894
+	ret = http_client_query(_m, url->s, &result,
895
+			(post && post->s && post->len>0)?post->s:NULL,
896
+			(hdrs && hdrs->s && hdrs->len>0)?hdrs->s:NULL);
896 897
 
897 898
 	val.rs = result;
898 899
 	val.flags = PV_VAL_STR;