Module: kamailio Branch: master Commit: 600d0e8fb7f24e424873e4ad24beb077d2b45ee4 URL: https://github.com/kamailio/kamailio/commit/600d0e8fb7f24e424873e4ad24beb077...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2021-07-24T08:16:49+02:00
ruxc: added http_reuse modparam
- enable connection reuse
---
Modified: src/modules/ruxc/doc/ruxc_admin.xml Modified: src/modules/ruxc/ruxc_mod.c
---
Diff: https://github.com/kamailio/kamailio/commit/600d0e8fb7f24e424873e4ad24beb077... Patch: https://github.com/kamailio/kamailio/commit/600d0e8fb7f24e424873e4ad24beb077...
---
diff --git a/src/modules/ruxc/doc/ruxc_admin.xml b/src/modules/ruxc/doc/ruxc_admin.xml index e4b0384ea4..e07c05c9f1 100644 --- a/src/modules/ruxc/doc/ruxc_admin.xml +++ b/src/modules/ruxc/doc/ruxc_admin.xml @@ -95,6 +95,27 @@ modparam("ruxc", "http_timeout", 2000) ... modparam("ruxc", "http_tlsmode", 1) ... +</programlisting> + </example> + </section> + <section id="ruxc.p.http_reuse"> + <title><varname>http_reuse</varname> (int)</title> + <para> + Set to 1 in order to reuse the connection for all requests (each &kamailio; + process has its own connection). Useful to avoid TCP connect (and TLS + handshake) when all requests are performed against the same HTTP/S server. + </para> + <para> + <emphasis> + Default value is 0 (new connection for each request). + </emphasis> + </para> + <example> + <title>Set <varname>http_reuse</varname> parameter</title> + <programlisting format="linespecific"> +... +modparam("ruxc", "http_reuse", 1) +... </programlisting> </example> </section> diff --git a/src/modules/ruxc/ruxc_mod.c b/src/modules/ruxc/ruxc_mod.c index 2cd1cd27d0..02fa278859 100644 --- a/src/modules/ruxc/ruxc_mod.c +++ b/src/modules/ruxc/ruxc_mod.c @@ -40,6 +40,7 @@ MODULE_VERSION
static int _ruxc_http_timeout = 5000; static int _ruxc_http_tlsmode = 0; +static int _ruxc_http_reuse = 0;
static int mod_init(void); static int child_init(int); @@ -73,6 +74,7 @@ static cmd_export_t cmds[]={ static param_export_t params[]={ {"http_timeout", PARAM_INT, &_ruxc_http_timeout}, {"http_tlsmode", PARAM_INT, &_ruxc_http_tlsmode}, + {"http_reuse", PARAM_INT, &_ruxc_http_reuse},
{0, 0, 0} }; @@ -132,6 +134,7 @@ static int ki_ruxc_http_get_helper(sip_msg_t *_msg, str *url, str *hdrs, v_http_request.timeout_read = _ruxc_http_timeout; v_http_request.timeout_write = _ruxc_http_timeout; v_http_request.tlsmode = _ruxc_http_tlsmode; + v_http_request.reuse = _ruxc_http_reuse;
v_http_request.url = url->s; v_http_request.url_len = url->len; @@ -229,6 +232,7 @@ static int ki_ruxc_http_post_helper(sip_msg_t *_msg, str *url, str *body, str *h v_http_request.timeout_read = _ruxc_http_timeout; v_http_request.timeout_write = _ruxc_http_timeout; v_http_request.tlsmode = _ruxc_http_tlsmode; + v_http_request.reuse = _ruxc_http_reuse;
v_http_request.url = url->s; v_http_request.url_len = url->len;