Module: kamailio
Branch: master
Commit: 61e076f0dbb302b88c5013503697afd9dfd81748
URL:
https://github.com/kamailio/kamailio/commit/61e076f0dbb302b88c5013503697afd…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2024-03-22T10:17:18+01:00
http_client: use core helpers for fixup of http request functions
---
Modified: src/modules/http_client/http_client.c
---
Diff:
https://github.com/kamailio/kamailio/commit/61e076f0dbb302b88c5013503697afd…
Patch:
https://github.com/kamailio/kamailio/commit/61e076f0dbb302b88c5013503697afd…
---
diff --git a/src/modules/http_client/http_client.c
b/src/modules/http_client/http_client.c
index 9be9b88d835..c15e36c4957 100644
--- a/src/modules/http_client/http_client.c
+++ b/src/modules/http_client/http_client.c
@@ -133,8 +133,6 @@ static int fixup_http_query_post(void **param, int param_no);
static int fixup_free_http_query_post(void **param, int param_no);
static int fixup_http_query_post_hdr(void **param, int param_no);
static int fixup_free_http_query_post_hdr(void **param, int param_no);
-static int fixup_http_query_request(void **param, int param_no);
-static int fixup_free_http_query_request(void **param, int param_no);
static int fixup_curl_connect(void **param, int param_no);
static int fixup_free_curl_connect(void **param, int param_no);
@@ -187,11 +185,11 @@ static cmd_export_t cmds[] = {
{"http_client_get", (cmd_function)w_http_query_get_hdr, 4,
fixup_http_query_post_hdr,
fixup_free_http_query_post_hdr,
REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE},
- {"http_client_request", (cmd_function)w_http_query_request, 5,
fixup_http_query_request,
- fixup_free_http_query_request,
+ {"http_client_request", (cmd_function)w_http_query_request, 5,
fixup_spve4_pvar,
+ fixup_free_spve4_pvar,
REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE},
- {"http_client_request_v2pk", (cmd_function)w_http_query_request_v2pk, 5,
fixup_http_query_request,
- fixup_free_http_query_request,
+ {"http_client_request_v2pk", (cmd_function)w_http_query_request_v2pk, 5,
fixup_spve4_pvar,
+ fixup_free_spve4_pvar,
REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE},
{"http_connect", (cmd_function)w_curl_connect, 3, fixup_curl_connect,
fixup_free_curl_connect,
@@ -639,49 +637,6 @@ static int fixup_free_curl_connect(void **param, int param_no)
return -1;
}
-/*
- * Fix http_client_request params: met, url, hdrs, data (strings that may contain
- * pvars) and result (writable pvar).
- */
-static int fixup_http_query_request(void **param, int param_no)
-{
- if(param_no <= 4) {
- return fixup_spve_null(param, 1);
- }
-
- if(param_no == 5) {
- if(fixup_pvar_null(param, 1) != 0) {
- LM_ERR("http_query: failed to fixup result pvar\n");
- return -1;
- }
- if(((pv_spec_t *)(*param))->setf == NULL) {
- LM_ERR("http_query: result pvar is not writeble\n");
- return -1;
- }
- return 0;
- }
-
- LM_ERR("invalid parameter number <%d>\n", param_no);
- return -1;
-}
-
-/*
- * Free http_client_request params.
- */
-static int fixup_free_http_query_request(void **param, int param_no)
-{
- if(param_no <= 4) {
- return fixup_free_spve_null(param, 1);
- }
-
- if(param_no == 5) {
- return fixup_free_pvar_null(param, 1);
- }
-
- LM_ERR("http_query: invalid parameter number <%d>\n", param_no);
- return -1;
-}
-
/*
* Wrapper for Curl_connect (GET)
*/