Browse code

http_client: new param query_maxdatasize

- set the maximum size to be downloaded for http_client_query() result
- default: 0 - disabled (unlimited size)

Daniel-Constantin Mierla authored on 13/08/2019 07:20:08
Showing 3 changed files
... ...
@@ -653,7 +653,7 @@ int http_client_query(
653 653
 	query_params.timeout = default_connection_timeout;
654 654
 	query_params.http_follow_redirect = default_http_follow_redirect;
655 655
 	query_params.oneline = default_query_result;
656
-	query_params.maxdatasize = 0;
656
+	query_params.maxdatasize = default_query_maxdatasize;
657 657
 	if(default_useragent.s != NULL && default_useragent.len > 0) {
658 658
 		query_params.useragent = default_useragent.s;
659 659
 	}
... ...
@@ -104,6 +104,8 @@ unsigned int default_authmethod =
104 104
  * - 0: return full result
105 105
  * - 1: return first line only */
106 106
 unsigned int default_query_result = 1;
107
+/*!< Default download size for result of query function. 0=disabled (no limit) */
108
+unsigned int default_query_maxdatasize = 0;
107 109
 
108 110
 str http_client_config_file = STR_NULL;
109 111
 
... ...
@@ -201,6 +203,7 @@ static param_export_t params[] = {
201 201
 	{"authmethod", PARAM_INT, &default_authmethod },
202 202
 	{"keep_connections", PARAM_INT, &default_keep_connections },
203 203
 	{"query_result", PARAM_INT, &default_query_result },
204
+	{"query_maxdatasize", PARAM_INT, &default_query_maxdatasize },
204 205
 	{0, 0, 0}
205 206
 };
206 207
 
... ...
@@ -63,6 +63,7 @@ extern unsigned int
63 63
 extern unsigned int
64 64
 		default_keep_connections; /*!< Keep http connections open for reuse */
65 65
 extern unsigned int default_query_result; /*!< Default query result mode */
66
+extern unsigned int default_query_maxdatasize; /*!< Default query result maximum download size */
66 67
 
67 68
 extern counter_handle_t connections; /* Number of connection definitions */
68 69
 extern counter_handle_t connok;		 /* Successful Connection attempts */