BugID:18973731:[http] update http download log and add rx buffer limit
#define HTTPCLIENT_READ_BUF_SIZE (1024) /* read payload */
#define HTTPCLIENT_RAED_HEAD_SIZE (32) /* read header */
#define HTTPCLIENT_SEND_BUF_SIZE (1024) /* send */
+#define HTTPCLIENT_CHUNK_SIZE (1024)
#define HTTPCLIENT_MAX_URL_LEN (256)
@@ -306,14 +307,14 @@ static int _http_get_response_body(httpclient_t *client, char *data, int data_le
/* get data from internet and put into "data" buf temporary */
if (client_data->retrieve_len) {
int ret;
- int max_len_to_receive = client_data->response_buf_len - 1 - written_response_buf_len;
+ int max_len_to_receive = HTTPCLIENT_MIN(HTTPCLIENT_CHUNK_SIZE - 1, client_data->response_buf_len - 1 - written_response_buf_len);
max_len_to_receive = HTTPCLIENT_MIN(max_len_to_receive, client_data->retrieve_len);
ret = _http_recv(client, data, max_len_to_receive, &data_len_actually_received, iotx_time_left(&timer));
if (ret == ERROR_HTTP_CONN) {
return ret;
}
- utils_debug("Total-Payload: %d Bytes; Read: %d Bytes", client_data->retrieve_len, data_len_actually_received);
+ utils_debug("Total-Remaining Payload: %d Bytes; currently Read: %d Bytes", client_data->retrieve_len, data_len_actually_received);
/* TODO add deadloop processing*/
ret = _utils_check_deadloop(data_len_actually_received, &timer, ret, &dead_loop_count,
