Module: kamailio
Branch: master
Commit: ea4b25c67c0e4ea072ce1bbc11ae21bc7c9484a3
URL:
https://github.com/kamailio/kamailio/commit/ea4b25c67c0e4ea072ce1bbc11ae21b…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2019-08-13T09:20:08+02:00
http_client: new param query_maxdatasize
- set the maximum size to be downloaded for http_client_query() result
- default: 0 - disabled (unlimited size)
---
Modified: src/modules/http_client/functions.c
Modified: src/modules/http_client/http_client.c
Modified: src/modules/http_client/http_client.h
---
Diff:
https://github.com/kamailio/kamailio/commit/ea4b25c67c0e4ea072ce1bbc11ae21b…
Patch:
https://github.com/kamailio/kamailio/commit/ea4b25c67c0e4ea072ce1bbc11ae21b…
---
diff --git a/src/modules/http_client/functions.c b/src/modules/http_client/functions.c
index 05dc827126..bfa42ac527 100644
--- a/src/modules/http_client/functions.c
+++ b/src/modules/http_client/functions.c
@@ -653,7 +653,7 @@ int http_client_query(
query_params.timeout = default_connection_timeout;
query_params.http_follow_redirect = default_http_follow_redirect;
query_params.oneline = default_query_result;
- query_params.maxdatasize = 0;
+ query_params.maxdatasize = default_query_maxdatasize;
if(default_useragent.s != NULL && default_useragent.len > 0) {
query_params.useragent = default_useragent.s;
}
diff --git a/src/modules/http_client/http_client.c
b/src/modules/http_client/http_client.c
index fc20b65525..bdc2253b3d 100644
--- a/src/modules/http_client/http_client.c
+++ b/src/modules/http_client/http_client.c
@@ -104,6 +104,8 @@ unsigned int default_authmethod =
* - 0: return full result
* - 1: return first line only */
unsigned int default_query_result = 1;
+/*!< Default download size for result of query function. 0=disabled (no limit) */
+unsigned int default_query_maxdatasize = 0;
str http_client_config_file = STR_NULL;
@@ -201,6 +203,7 @@ static param_export_t params[] = {
{"authmethod", PARAM_INT, &default_authmethod },
{"keep_connections", PARAM_INT, &default_keep_connections },
{"query_result", PARAM_INT, &default_query_result },
+ {"query_maxdatasize", PARAM_INT, &default_query_maxdatasize },
{0, 0, 0}
};
diff --git a/src/modules/http_client/http_client.h
b/src/modules/http_client/http_client.h
index 7f236dfa7e..a3620bd233 100644
--- a/src/modules/http_client/http_client.h
+++ b/src/modules/http_client/http_client.h
@@ -63,6 +63,7 @@ extern unsigned int
extern unsigned int
default_keep_connections; /*!< Keep http connections open for reuse */
extern unsigned int default_query_result; /*!< Default query result mode */
+extern unsigned int default_query_maxdatasize; /*!< Default query result maximum
download size */
extern counter_handle_t connections; /* Number of connection definitions */
extern counter_handle_t connok; /* Successful Connection attempts */