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

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2024-04-08T14:14:58+02:00

http_client: added http_client_response_headers_clear()

- clear response headers
- if not explicitely done, it happens when next http request is
  performed

---

Modified: src/modules/http_client/http_client.c

---

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

---

diff --git a/src/modules/http_client/http_client.c 
b/src/modules/http_client/http_client.c
index c8af2f64901..27310829d0e 100644
--- a/src/modules/http_client/http_client.c
+++ b/src/modules/http_client/http_client.c
@@ -160,6 +160,8 @@ static int w_http_query_request_v2pk(struct sip_msg *_m, 
char *_met, char *_url,
                char *_body, char *_hdrs, char *_result);
 static int w_http_client_response_headers_set(
                sip_msg_t *_m, char *_pval, char *_p2);
+static int w_http_client_response_headers_clear(
+               sip_msg_t *_m, char *_p1, char *_p2);
 
 /* forward function */
 static int curl_con_param(modparam_t type, void *val);
@@ -205,6 +207,9 @@ static cmd_export_t cmds[] = {
        {"http_client_response_headers_set",
                (cmd_function)w_http_client_response_headers_set, 1, 
fixup_igp_null,
                fixup_free_igp_null, ANY_ROUTE},
+       {"http_client_response_headers_clear",
+               (cmd_function)w_http_client_response_headers_clear, 1, 0,
+               0, ANY_ROUTE},
        {"bind_http_client",  (cmd_function)bind_httpc_api,  0, 0, 0, 0},
        {0,0,0,0,0,0}
 };
@@ -1184,6 +1189,16 @@ static int w_http_client_response_headers_set(
        return ki_http_client_response_headers_set(_m, ival);
 }
 
+/*!
+ *
+ */
+static int w_http_client_response_headers_clear(
+               sip_msg_t *_m, char *_pval, char *_p2)
+{
+       http_client_response_headers_reset();
+       return 1;
+}
+
 /*!
  * Parse arguments to  pv $curlerror
  */

_______________________________________________
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org

Reply via email to