kamailio.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
List overview
Download
sr-dev
November 2015
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
sr-dev@lists.kamailio.org
27 participants
315 discussions
Start a n
N
ew thread
git:master:19756eec: ctl: increased default buffers size for rpc responses
by Daniel-Constantin Mierla
Module: kamailio Branch: master Commit: 19756eecb2048320182667cc440cfa7d275304c9 URL:
https://github.com/kamailio/kamailio/commit/19756eecb2048320182667cc440cfa7…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2015-11-02T13:30:32+01:00 ctl: increased default buffers size for rpc responses - binrpc_max_body_size = 32 - binrpc_struct_max_body_size = 8 --- Modified: modules/ctl/README Modified: modules/ctl/binrpc_run.c Modified: modules/ctl/doc/ctl_params.xml --- Diff:
https://github.com/kamailio/kamailio/commit/19756eecb2048320182667cc440cfa7…
Patch:
https://github.com/kamailio/kamailio/commit/19756eecb2048320182667cc440cfa7…
--- diff --git a/modules/ctl/README b/modules/ctl/README index 09f35d4..2de6fcb 100644 --- a/modules/ctl/README +++ b/modules/ctl/README @@ -235,20 +235,20 @@ modparam("ctl", "autoconversion", 1) Set the size of binrpc buffer for RPC reply. Value represents kilobytes. - Default: 4 (meaning 4KB); + Default: 32 (meaning 32KB); Example 1.8. Set the binrpc_max_body_size parameter -modparam("ctl", "binrpc_max_body_size", 10) +modparam("ctl", "binrpc_max_body_size", 16) 3.8. binrpc_struct_max_body_size (integer) Set the size of binrpc structure buffer for RPC reply. Value represents kilobytes. - Default: 1 (meaning 1KB); + Default: 8 (meaning 8KB); Example 1.9. Set the binrpc_struct_max_body_size parameter -modparam("ctl", "binrpc_struct_max_body_size", 3) +modparam("ctl", "binrpc_struct_max_body_size", 4) 4. SIP-router RPC Functions diff --git a/modules/ctl/binrpc_run.c b/modules/ctl/binrpc_run.c index c4b7297..2355a50 100644 --- a/modules/ctl/binrpc_run.c +++ b/modules/ctl/binrpc_run.c @@ -36,8 +36,9 @@ rpc->scan (default: not set) */ int autoconvert=0; -int binrpc_max_body_size = 4; /* multiplied by 1024 in mod init */ -int binrpc_struct_max_body_size = 1; /* multiplied by 1024 in mod init */ +int binrpc_max_body_size = 32; /* multiplied by 1024 in mod init */ +int binrpc_struct_max_body_size = 8; /* multiplied by 1024 in mod init */ + #define BINRPC_MAX_BODY binrpc_max_body_size /* maximum body for send */ #define STRUCT_MAX_BODY binrpc_struct_max_body_size #define MAX_MSG_CHUNKS 96 diff --git a/modules/ctl/doc/ctl_params.xml b/modules/ctl/doc/ctl_params.xml index 3bd2553..09041bd 100644 --- a/modules/ctl/doc/ctl_params.xml +++ b/modules/ctl/doc/ctl_params.xml @@ -200,13 +200,13 @@ modparam("ctl", "autoconversion", 1) kilobytes. </para> <para> - Default: 4 (meaning 4KB); + Default: 32 (meaning 32KB); </para> <example> <title>Set the <varname>binrpc_max_body_size</varname> parameter </title> <programlisting> -modparam("ctl", "binrpc_max_body_size", 10) +modparam("ctl", "binrpc_max_body_size", 16) </programlisting> </example> </section> @@ -218,13 +218,13 @@ modparam("ctl", "binrpc_max_body_size", 10) kilobytes. </para> <para> - Default: 1 (meaning 1KB); + Default: 8 (meaning 8KB); </para> <example> <title>Set the <varname>binrpc_struct_max_body_size</varname> parameter </title> <programlisting> -modparam("ctl", "binrpc_struct_max_body_size", 3) +modparam("ctl", "binrpc_struct_max_body_size", 4) </programlisting> </example> </section>
9 years, 1 month
1
0
0
0
git:master:f12e03e1: curl Enforce max data size when downloading data. Stop re-allocating memory for data we do not bother with.
by Olle E. Johansson
Module: kamailio Branch: master Commit: f12e03e1c171a723097eb14f1074d705ed1404e4 URL:
https://github.com/kamailio/kamailio/commit/f12e03e1c171a723097eb14f1074d70…
Author: Olle E. Johansson <oej(a)edvina.net> Committer: Olle E. Johansson <oej(a)edvina.net> Date: 2015-11-02T11:44:49+01:00 curl Enforce max data size when downloading data. Stop re-allocating memory for data we do not bother with. --- Modified: modules/curl/curl.h Modified: modules/curl/functions.c --- Diff:
https://github.com/kamailio/kamailio/commit/f12e03e1c171a723097eb14f1074d70…
Patch:
https://github.com/kamailio/kamailio/commit/f12e03e1c171a723097eb14f1074d70…
--- diff --git a/modules/curl/curl.h b/modules/curl/curl.h index b83438c..8f5aba9 100644 --- a/modules/curl/curl.h +++ b/modules/curl/curl.h @@ -55,7 +55,8 @@ typedef struct { char *buf; size_t curr_size; size_t pos; -} http_res_stream_t; + size_t max_size; +} curl_res_stream_t; /*! Predefined connection objects */ @@ -76,7 +77,7 @@ typedef struct _curl_con unsigned int port; /*!< The port to connect to */ int timeout; /*!< Timeout for this connection */ long maxdatasize; /*!< Maximum data download on GET or POST */ - http_res_stream_t *stream; /*!< Curl stream */ + curl_res_stream_t *stream; /*!< Curl stream */ struct _curl_con *next; /*!< next connection */ char redirecturl[512]; /*!< Last redirect URL - to use for $curlredirect(curlcon) pv */ } curl_con_t; diff --git a/modules/curl/functions.c b/modules/curl/functions.c index 19908c6..6925c71 100644 --- a/modules/curl/functions.c +++ b/modules/curl/functions.c @@ -60,26 +60,26 @@ static int curL_query_url(struct sip_msg* _m, char* _url, char* _dst, const char */ size_t write_function( void *ptr, size_t size, size_t nmemb, void *stream_ptr) { - /* A question here is if we can somehow signal maxdatasize and stop filling - buffers at maxdatasize - we don't need any more. Or just ignore and stop - allocating pkg memory at that point. A good todo. - */ - http_res_stream_t *stream = (http_res_stream_t *) stream_ptr; - - stream->buf = (char *) pkg_realloc(stream->buf, stream->curr_size + - (size * nmemb) + 1); - - if (stream->buf == NULL) { - LM_ERR("cannot allocate memory for stream\n"); - return CURLE_WRITE_ERROR; - } + curl_res_stream_t *stream = (curl_res_stream_t *) stream_ptr; + + + if (stream->max_size == 0 || stream->curr_size < stream->max_size) { + stream->buf = (char *) pkg_realloc(stream->buf, stream->curr_size + (size * nmemb) + 1); - memcpy(&stream->buf[stream->pos], (char *) ptr, (size * nmemb)); + if (stream->buf == NULL) { + LM_ERR("cannot allocate memory for stream\n"); + return CURLE_WRITE_ERROR; + } - stream->curr_size += ((size * nmemb) + 1); - stream->pos += (size * nmemb); + memcpy(&stream->buf[stream->pos], (char *) ptr, (size * nmemb)); - stream->buf[stream->pos + 1] = '\0'; + stream->curr_size += ((size * nmemb) + 1); + stream->pos += (size * nmemb); + + stream->buf[stream->pos + 1] = '\0'; + } else { + LM_DBG("****** ##### CURL Max datasize exceeded: max %u current %u\n", (unsigned int) stream->max_size, (unsigned int)stream->curr_size); + } return size * nmemb; } @@ -93,7 +93,7 @@ static int curL_query_url(struct sip_msg* _m, char* _url, char* _dst, const char CURLcode res; str value; char *url, *at = NULL; - http_res_stream_t stream; + curl_res_stream_t stream; long stat; pv_spec_t *dst; pv_value_t val; @@ -101,7 +101,8 @@ static int curL_query_url(struct sip_msg* _m, char* _url, char* _dst, const char double total_time; struct curl_slist *headerlist = NULL; - memset(&stream, 0, sizeof(http_res_stream_t)); + memset(&stream, 0, sizeof(curl_res_stream_t)); + stream.max_size = (size_t) maxdatasize; value.s = _url; value.len = strlen(_url);
9 years, 1 month
1
0
0
0
git:master:edf6fb9d: curl Removing some unused variables
by Olle E. Johansson
Module: kamailio Branch: master Commit: edf6fb9dc68acacf109bb421679289726dd8901d URL:
https://github.com/kamailio/kamailio/commit/edf6fb9dc68acacf109bb4216792897…
Author: Olle E. Johansson <oej(a)edvina.net> Committer: Olle E. Johansson <oej(a)edvina.net> Date: 2015-11-02T11:16:52+01:00 curl Removing some unused variables --- Modified: modules/curl/curl.c Modified: modules/curl/curlcon.c Modified: modules/curl/curlrpc.c Modified: modules/curl/functions.c --- Diff:
https://github.com/kamailio/kamailio/commit/edf6fb9dc68acacf109bb4216792897…
Patch:
https://github.com/kamailio/kamailio/commit/edf6fb9dc68acacf109bb4216792897…
--- diff --git a/modules/curl/curl.c b/modules/curl/curl.c index a485604..1e253a7 100644 --- a/modules/curl/curl.c +++ b/modules/curl/curl.c @@ -83,10 +83,6 @@ unsigned int default_maxdatasize = 0; /*!< Default download size. 0=disabled */ static curl_version_info_data *curl_info; -/* lock for configuration access */ -static gen_lock_t *conf_lock = NULL; - - /* Module management function prototypes */ static int mod_init(void); static int child_init(int); @@ -571,7 +567,6 @@ static int pv_get_curlerror(struct sip_msg *msg, pv_param_t *param, pv_value_t * { str curlerr; char *err = NULL; - CURLcode codeerr; if(param==NULL) { return -1; @@ -598,7 +593,6 @@ static int pv_get_curlerror(struct sip_msg *msg, pv_param_t *param, pv_value_t * */ static int pv_parse_curlredirect(pv_spec_p sp, str *in) { - int cerr = 0; if(sp==NULL || in==NULL || in->len<=0) { return -1; } diff --git a/modules/curl/curlcon.c b/modules/curl/curlcon.c index 3d3de99..c573cab 100644 --- a/modules/curl/curlcon.c +++ b/modules/curl/curlcon.c @@ -239,8 +239,6 @@ int curl_parse_param(char *val) if (*p == ';') { /* We have parameters */ str tok; - int_str ival; - int itype; param_t *pit = NULL; /* Adjust the URL length */ diff --git a/modules/curl/curlrpc.c b/modules/curl/curlrpc.c index 551c9b3..a5b31b5 100644 --- a/modules/curl/curlrpc.c +++ b/modules/curl/curlrpc.c @@ -44,12 +44,7 @@ static const char* curl_rpc_listcon_doc[2] = { static void curl_rpc_listcon(rpc_t* rpc, void* ctx) { void* th; - void* ih; void* rh; - void* sh; - int j; - char c[3]; - str data = {"", 0}; curl_con_t *cc; cc = _curl_con_root; diff --git a/modules/curl/functions.c b/modules/curl/functions.c index 214eb32..19908c6 100644 --- a/modules/curl/functions.c +++ b/modules/curl/functions.c @@ -92,7 +92,7 @@ static int curL_query_url(struct sip_msg* _m, char* _url, char* _dst, const char CURL *curl; CURLcode res; str value; - char *url, *at = NULL, *post; + char *url, *at = NULL; http_res_stream_t stream; long stat; pv_spec_t *dst; @@ -172,6 +172,9 @@ static int curL_query_url(struct sip_msg* _m, char* _url, char* _dst, const char res = curl_easy_perform(curl); } pkg_free(url); + if (headerlist) { + curl_slist_free_all(headerlist); + } if (res != CURLE_OK) { /*
http://curl.haxx.se/libcurl/c/libcurl-errors.html
*/ @@ -183,7 +186,6 @@ static int curL_query_url(struct sip_msg* _m, char* _url, char* _dst, const char LM_ERR("failed to perform curl (%d)\n", res); } - curl_slist_free_all(headerlist); curl_easy_cleanup(curl); if(stream.buf) { pkg_free(stream.buf); @@ -246,9 +248,6 @@ static int curL_query_url(struct sip_msg* _m, char* _url, char* _dst, const char } /* CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ... ); */ - if (headerlist) { - curl_slist_free_all(headerlist); - } curl_easy_cleanup(curl); pkg_free(stream.buf); return stat; @@ -267,7 +266,6 @@ int curl_con_query_url(struct sip_msg* _m, char *connection, char* _url, char* _ str urlbuf2; char *urlbuf3 = NULL; - unsigned int len = 0; str postdatabuf; char *postdata = NULL; unsigned int maxdatasize = default_maxdatasize;
9 years, 1 month
1
0
0
0
git:master:38a3d0ca: Curl: Make base URI pvar
by Olle E. Johansson
Module: kamailio Branch: master Commit: 38a3d0ca6c09c851835eaf0875a4cee7fa947e61 URL:
https://github.com/kamailio/kamailio/commit/38a3d0ca6c09c851835eaf0875a4cee…
Author: Olle E. Johansson <oej(a)edvina.net> Committer: Olle E. Johansson <oej(a)edvina.net> Date: 2015-11-01T20:25:38+01:00 Curl: Make base URI pvar --- Modified: modules/curl/curl.c Modified: modules/curl/functions.c --- Diff:
https://github.com/kamailio/kamailio/commit/38a3d0ca6c09c851835eaf0875a4cee…
Patch:
https://github.com/kamailio/kamailio/commit/38a3d0ca6c09c851835eaf0875a4cee…
--- diff --git a/modules/curl/curl.c b/modules/curl/curl.c index ae9f464..a485604 100644 --- a/modules/curl/curl.c +++ b/modules/curl/curl.c @@ -389,7 +389,8 @@ static int fixup_curl_connect(void** param, int param_no) /* * Fix curl_connect params when posting (5 parameters): - * connection (string/pvar), url (string with pvars), content-type, data (string/pvar, pvar + * connection (string/pvar), url (string with pvars), content-type, + * data (string/pvar, pvar) */ static int fixup_curl_connect_post(void** param, int param_no) { @@ -397,12 +398,12 @@ static int fixup_curl_connect_post(void** param, int param_no) str s; pv_elem_t *pv = NULL; - if (param_no == 1 || param_no == 2 || param_no == 3) { + if (param_no == 1 || param_no == 3) { /* We want char * strings */ - /* At some point we need to allow pvars in the string. */ return 0; } - if (param_no == 4) { + /* URL and data may contain pvar */ + if (param_no == 4 || param_no == 2) { s.s = (char*)(*param); s.len = strlen(s.s); diff --git a/modules/curl/functions.c b/modules/curl/functions.c index 4c9961e..214eb32 100644 --- a/modules/curl/functions.c +++ b/modules/curl/functions.c @@ -264,6 +264,9 @@ int curl_con_query_url(struct sip_msg* _m, char *connection, char* _url, char* _ char passwordbuf[BUFSIZ/2]; char connurlbuf[BUFSIZ/2]; char urlbuf[512]; + str urlbuf2; + char *urlbuf3 = NULL; + unsigned int len = 0; str postdatabuf; char *postdata = NULL; @@ -292,9 +295,41 @@ int curl_con_query_url(struct sip_msg* _m, char *connection, char* _url, char* _ strncpy(passwordbuf, conn->password.s, conn->password.len); strncpy(connurlbuf, conn->url.s, conn->url.len); - strncpy(urlbuf,conn->schema.s, conn->schema.len); - snprintf(&urlbuf[conn->schema.len],(sizeof(urlbuf) - conn->schema.len), "://%s%s%s", connurlbuf, - (_url[0] && _url[0] == '/')?"":(_url[0] != '\0' ? "/": ""), _url); + LM_DBG("******** CURL Connection found %s\n", connection); + + if (_url && *_url) { + if(pv_printf_s(_m, (pv_elem_t*) _url, &urlbuf2) != 0) { + LM_ERR("curl :: unable to handle post data %s\n", _url); + return -1; + } + if(urlbuf2.s==NULL || urlbuf2.len == 0) { + LM_ERR("curl :: invalid url parameter\n"); + return -1; + } + LM_DBG("******** CURL Connection URL parsed for %s\n", connection); + /* Allocated using pkg_memory */ + urlbuf3 = as_asciiz(&urlbuf2); + if (urlbuf3 == NULL) { + ERR("Curl: No memory left\n"); + return -1; + } + LM_DBG("******** CURL URL string after PV parsing %s\n", urlbuf3); + } else { + LM_DBG("******** CURL URL string NULL no PV parsing %s\n", _url); + } + strncpy(urlbuf, conn->schema.s, conn->schema.len); + if (urlbuf3 != NULL) { + snprintf(&urlbuf[conn->schema.len],(sizeof(urlbuf) - conn->schema.len), "://%s%s%s", connurlbuf, + (urlbuf3[0] && urlbuf3[0] == '/')?"":(urlbuf3[0] != '\0' ? "/": ""), urlbuf3); + } else { + snprintf(&urlbuf[conn->schema.len],(sizeof(urlbuf) - conn->schema.len), "://%s%s%s", connurlbuf, + (_url[0] && _url[0] == '/')?"":(_url[0] != '\0' ? "/": ""), _url); + } + + /* Release the memory allocated by as_asciiz */ + if (urlbuf3 != NULL) { + pkg_free(urlbuf3); + } LM_DBG("***** #### ***** CURL URL: %s \n", urlbuf); if (_post && *_post) { if(pv_printf_s(_m, (pv_elem_t*)_post, &postdatabuf) != 0) { @@ -319,6 +354,7 @@ int curl_con_query_url(struct sip_msg* _m, char *connection, char* _url, char* _ res = curL_query_url(_m, urlbuf, _result, usernamebuf, passwordbuf, (contenttype ? contenttype : "text/plain"), postdata, conn->timeout, conn->http_follow_redirect, 0, (unsigned int) maxdatasize ); + LM_DBG("***** #### ***** CURL DONE : %s \n", urlbuf); if (postdata != NULL) { pkg_free(postdata); }
9 years, 1 month
1
0
0
0
git:master:2b3ad40a: curl remove some debug output
by Olle E. Johansson
Module: kamailio Branch: master Commit: 2b3ad40ae086382b1cdefa8ce15da6aa8a8e7f77 URL:
https://github.com/kamailio/kamailio/commit/2b3ad40ae086382b1cdefa8ce15da6a…
Author: Olle E. Johansson <oej(a)edvina.net> Committer: Olle E. Johansson <oej(a)edvina.net> Date: 2015-11-01T20:25:38+01:00 curl remove some debug output --- Modified: modules/curl/curlcon.c --- Diff:
https://github.com/kamailio/kamailio/commit/2b3ad40ae086382b1cdefa8ce15da6a…
Patch:
https://github.com/kamailio/kamailio/commit/2b3ad40ae086382b1cdefa8ce15da6a…
--- diff --git a/modules/curl/curlcon.c b/modules/curl/curlcon.c index 8580905..3d3de99 100644 --- a/modules/curl/curlcon.c +++ b/modules/curl/curlcon.c @@ -71,8 +71,6 @@ curl_con_t* curl_get_connection(str *name) cc = _curl_con_root; while(cc) { - LM_DBG("---> curl_get_connection comparing with curlcon: [%.*s]\n", cc->name.len, cc->name.s); - LM_DBG("---> curl_get_connection comparing conid %u with cc->conid %u \n", conid, cc->conid); if(conid==cc->conid && cc->name.len==name->len && strncmp(cc->name.s, name->s, name->len)==0) { return cc; }
9 years, 1 month
1
0
0
0
← Newer
1
...
29
30
31
32
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Results per page:
10
25
50
100
200