[sr-dev] git:master:756d1520: httpapitest Actually use the API function :-)

Olle E. Johansson oej at edvina.net
Tue Jun 7 08:37:53 CEST 2016


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

Author: Olle E. Johansson <oej at edvina.net>
Committer: Olle E. Johansson <oej at edvina.net>
Date: 2016-06-07T08:37:50+02:00

httpapitest Actually use the API function :-)

---

Modified: test/mod_httpapitest/httpapitest.c
Modified: test/mod_httpapitest/test/curlapi.cfg

---

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

---

diff --git a/test/mod_httpapitest/httpapitest.c b/test/mod_httpapitest/httpapitest.c
index e9ee538..be50d51 100644
--- a/test/mod_httpapitest/httpapitest.c
+++ b/test/mod_httpapitest/httpapitest.c
@@ -52,6 +52,7 @@ static int fixup_free_testcurl_connect(void** param, int param_no);
 static int fixup_testcurl_connect_post(void** param, int param_no);
 static int fixup_free_testcurl_connect_post(void** param, int param_no);
 static int w_testcurl_connect(struct sip_msg* _m, char* _con, char * _url, char* _result);
+static httpc_api_t httpapi;
 
 /* Exported functions */
 static cmd_export_t cmds[] = {
@@ -83,12 +84,12 @@ struct module_exports exports = {
 	child_init /* per-child init function */
 };
 
+
 /* Module initialization function */
 static int mod_init(void)
 {
 	
 	LM_DBG("init httpapitest module\n");
-	httpc_api_t httpapi;
 
 	if (httpc_load_api(&httpapi) != 0) {
 		LM_ERR("Can not bind to http_client API \n");
@@ -199,7 +200,9 @@ static int w_testcurl_connect(struct sip_msg* _m, char* _con, char * _url, char*
 
 	LM_DBG("**** Curl Connection %s URL %s Result var %s\n", _con, _url, _result);
 
-	ret = curl_con_query_url(_m, &con, &url, &result, NULL, NULL);
+	
+	/* API    http_connect(msg, connection, url, result, content_type, post) */
+	ret = httpapi.http_connect(_m, &con, &url, &result, NULL, NULL);
 
 	val.rs = result;
 	val.flags = PV_VAL_STR;
diff --git a/test/mod_httpapitest/test/curlapi.cfg b/test/mod_httpapitest/test/curlapi.cfg
index 2dc29ab..4cd6ff0 100644
--- a/test/mod_httpapitest/test/curlapi.cfg
+++ b/test/mod_httpapitest/test/curlapi.cfg
@@ -56,8 +56,10 @@ onsend_route
 event_route[htable:mod-init]
 {
 	xlog("L_ERR", "### Kamailio starting $timef(HH:mm) \n");
-	$avp(gurka) = "";
-	$var(res) = test_http_connect("lisa", "", "$avp(gurka)");
+	$var(html) = "";
+
+	$var(res) = test_http_connect("lisa", "", "$avp(html)");
+
 	xlog("L_ERR", "-- Lisa http_client connection: $avp(gurka) Result $var(res)\n");
 
 




More information about the sr-dev mailing list