summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlijia <[email protected]>2024-08-14 18:58:20 +0800
committerlijia <[email protected]>2024-08-15 14:18:27 +0800
commit79c16fa9f61485f369a24c49fc9ce67f3f95987c (patch)
tree3dcae0d0678c7e6393b88a608a47b887f18d4096
parent176562c0c17d072c575ba0768c15cace5b4b5c48 (diff)
fix TSG-22207, after tcp reorder,trigger many TCP_STREAM messages one time.dev-native-stellar
-rw-r--r--src/http_content_decompress.cpp22
-rw-r--r--src/http_decoder.cpp93
-rw-r--r--src/http_decoder_half.cpp111
-rw-r--r--src/http_decoder_half.h7
-rw-r--r--src/http_decoder_stat.cpp6
-rw-r--r--src/http_decoder_stat.h2
-rw-r--r--test/http_pcap/http_gzip_out_of_order.pcapbin33831 -> 33831 bytes
-rw-r--r--test/http_pcap/http_out_of_order.pcapbin74700 -> 73376 bytes
-rw-r--r--test/test_result_json/http_gzip_out_of_order.json2
-rw-r--r--test/test_result_json/http_out_of_order.json3
-rw-r--r--test_based_on_stellar/env/stellar.toml24
11 files changed, 218 insertions, 52 deletions
diff --git a/src/http_content_decompress.cpp b/src/http_content_decompress.cpp
index 0ecd9ca..ff386c2 100644
--- a/src/http_content_decompress.cpp
+++ b/src/http_content_decompress.cpp
@@ -13,7 +13,7 @@
#include <brotli/decode.h>
#include "http_decoder_inc.h"
-#define BUFFER_SIZE (16 * 1024)
+#define HTTP_DECOMPRESS_BUFFER_SIZE (4096)
struct http_content_decompress {
enum http_content_encoding encoding;
@@ -64,10 +64,6 @@ http_content_decompress_create(enum http_content_encoding encoding)
decompress->z_stream_ptr = NULL;
decompress->br_state = NULL;
- decompress->buffer = CALLOC(char, BUFFER_SIZE);
- assert(decompress->buffer);
- decompress->buffer_size = BUFFER_SIZE;
-
if (encoding == HTTP_CONTENT_ENCODING_GZIP
|| encoding == HTTP_CONTENT_ENCODING_DEFLATE) {
decompress->z_stream_ptr = CALLOC(z_stream, 1);
@@ -147,6 +143,7 @@ http_content_decompress_write_zlib(struct http_content_decompress *decompress,
size_t have = decompress->buffer_size - z_stream_ptr->avail_out;
if (have > 0) {
if (0 == z_stream_ptr->avail_out) {
+ fprintf(stderr, "realloc outbuffer,before: %zu bytes, after :%zu B\n", decompress->buffer_size , decompress->buffer_size + have); ;
decompress->buffer_size += have;
decompress->buffer = REALLOC(char, decompress->buffer,
decompress->buffer_size);
@@ -167,6 +164,8 @@ http_content_decompress_write_zlib(struct http_content_decompress *decompress,
break;
}
} while (z_stream_ptr->avail_in != 0);
+ decompress->buffer = NULL;
+ decompress->buffer_size = 0;
return 0;
}
@@ -205,15 +204,16 @@ http_content_decompress_write_br(struct http_content_decompress *decompress,
if (ret == BROTLI_DECODER_RESULT_SUCCESS ||
ret == BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT) {
+ decompress->buffer =NULL;
+ decompress->buffer_size = 0;
return 0;
}
if (ret == BROTLI_DECODER_RESULT_ERROR) {
BrotliDecoderErrorCode errcode =
BrotliDecoderGetErrorCode(decompress->br_state);
- // http_decoder_log(ERROR,
- // "BrotliDecoderDecompressStream() failed: errno = %d, %s",
- // errcode, BrotliDecoderErrorString(errcode));
+ *outdata = NULL;
+ *outdata_len = 0;
return -1;
}
@@ -234,6 +234,12 @@ int http_content_decompress_write(struct http_content_decompress *decompress,
*outdata = NULL;
*outdata_len = 0;
+ if(NULL == decompress->buffer ){
+ decompress->buffer = CALLOC(char, HTTP_DECOMPRESS_BUFFER_SIZE);
+ assert(decompress->buffer);
+ decompress->buffer_size = HTTP_DECOMPRESS_BUFFER_SIZE;
+ }
+
if (decompress->encoding == HTTP_CONTENT_ENCODING_GZIP ||
decompress->encoding == HTTP_CONTENT_ENCODING_DEFLATE) {
return http_content_decompress_write_zlib(decompress, indata, indata_len,
diff --git a/src/http_decoder.cpp b/src/http_decoder.cpp
index 3960869..663d730 100644
--- a/src/http_decoder.cpp
+++ b/src/http_decoder.cpp
@@ -17,24 +17,40 @@ struct http_message *http_message_new(enum http_message_type type, struct http_d
}
struct http_message *http_body_message_new(enum http_message_type type, struct http_decoder_result_queue *queue,
- int queue_index, uint8_t flow_type, hstring *raw_payload)
+ int queue_index, uint8_t flow_type, hstring *raw_payload, hstring *decompress_payload)
{
struct http_message *msg = CALLOC(struct http_message, 1);
msg->type = type;
msg->ref_queue = queue;
msg->queue_index = queue_index;
msg->flow_type = flow_type;
- msg->raw_payload.iov_base = raw_payload->iov_base;
- msg->raw_payload.iov_len = raw_payload->iov_len;
+ if (raw_payload)
+ {
+ msg->raw_payload.iov_base = raw_payload->iov_base;
+ msg->raw_payload.iov_len = raw_payload->iov_len;
+ }
+ if (decompress_payload)
+ {
+ msg->decompress_payload.iov_base = decompress_payload->iov_base;
+ msg->decompress_payload.iov_len = decompress_payload->iov_len;
+ }
return msg;
}
-static void http_message_decompress_free(struct http_message *msg)
+static void http_message_decompress_buffer_free(struct http_message *msg)
{
- if((msg->type == HTTP_MESSAGE_REQ_BODY)
- || (msg->type == HTTP_MESSAGE_RES_BODY))
+ struct http_decoder_half_data *ref_data = NULL;
+ if (HTTP_MESSAGE_REQ_BODY_START == msg->type || HTTP_MESSAGE_REQ_BODY == msg->type || HTTP_MESSAGE_REQ_BODY_END == msg->type)
{
- // todo, for tcp reorder, maybe receive many many tcp segment
+ ref_data = msg->ref_queue->array[msg->queue_index].req_data;
+ }
+ else if (HTTP_MESSAGE_RES_BODY_START == msg->type || HTTP_MESSAGE_RES_BODY == msg->type || HTTP_MESSAGE_RES_BODY_END == msg->type)
+ {
+ ref_data = msg->ref_queue->array[msg->queue_index].res_data;
+ }
+ if (ref_data != NULL && msg->decompress_payload.iov_base != NULL)
+ {
+ http_half_decompress_buffer_free(ref_data, &msg->decompress_payload);
}
}
@@ -42,7 +58,7 @@ static void http_message_free(void *http_msg, void *cb_arg)
{
if (http_msg)
{
- http_message_decompress_free((struct http_message *)http_msg);
+ http_message_decompress_buffer_free((struct http_message *)http_msg);
FREE(http_msg);
}
}
@@ -153,11 +169,17 @@ static void http_event_handler(enum http_event event, struct http_decoder_half_d
case HTTP_EVENT_REQ_BODY_DATA:
{
hstring raw_body = {};
+ hstring decompress_body = {};
http_decoder_half_data_get_raw_body(half_data, &raw_body);
- msg = http_body_message_new(HTTP_MESSAGE_REQ_BODY, queue, queue_idx, HTTP_REQUEST, &raw_body);
+ http_half_get_lastest_decompress_buffer(half_data, &decompress_body);
+ msg = http_body_message_new(HTTP_MESSAGE_REQ_BODY, queue, queue_idx, HTTP_REQUEST, &raw_body, &decompress_body);
session_mq_publish_message(ev_ctx->ref_session, exdata->pub_topic_id, msg);
+ if(decompress_body.iov_base != NULL){
+ http_decoder_stat_update(&httpd_env->hd_stat, thread_id, HTTPD_STAT_ZIP_BYTES, raw_body.iov_len);
+ http_decoder_stat_update(&httpd_env->hd_stat, thread_id, HTTPD_STAT_UNZIP_BYTES, decompress_body.iov_len);
+ }
}
- break;
+ break;
case HTTP_EVENT_REQ_BODY_END:
msg = http_message_new(HTTP_MESSAGE_REQ_BODY_END, queue, queue_idx, HTTP_REQUEST);
session_mq_publish_message(ev_ctx->ref_session, exdata->pub_topic_id, msg);
@@ -279,10 +301,16 @@ static void http_event_handler(enum http_event event, struct http_decoder_half_d
{
hstring raw_body = {};
http_decoder_half_data_get_raw_body(half_data, &raw_body);
- msg = http_body_message_new(HTTP_MESSAGE_RES_BODY, queue, queue_idx, HTTP_RESPONSE, &raw_body);
+ hstring decompress_body = {};
+ http_half_get_lastest_decompress_buffer(half_data, &decompress_body);
+ msg = http_body_message_new(HTTP_MESSAGE_RES_BODY, queue, queue_idx, HTTP_RESPONSE, &raw_body, &decompress_body);
session_mq_publish_message(ev_ctx->ref_session, exdata->pub_topic_id, msg);
+ if(decompress_body.iov_base != NULL){
+ http_decoder_stat_update(&httpd_env->hd_stat, thread_id, HTTPD_STAT_ZIP_BYTES, raw_body.iov_len);
+ http_decoder_stat_update(&httpd_env->hd_stat, thread_id, HTTPD_STAT_UNZIP_BYTES, decompress_body.iov_len);
+ }
}
- break;
+ break;
case HTTP_EVENT_RES_BODY_END:
msg = http_message_new(HTTP_MESSAGE_RES_BODY_END, queue, queue_idx, HTTP_RESPONSE);
session_mq_publish_message(ev_ctx->ref_session, exdata->pub_topic_id, msg);
@@ -535,6 +563,7 @@ static int http_msg_response_header_next(const struct http_message *msg, struct
return http_decoder_half_data_iter_header((struct http_decoder_half_data *)res_data, hdr);
}
+#if 0
static int http_msg_get_request_raw_body(const struct http_message *msg, hstring *body)
{
const struct http_decoder_half_data *req_data =
@@ -562,6 +591,7 @@ static int http_msg_get_response_decompress_body(const struct http_message *msg,
msg->ref_queue->array[msg->queue_index].res_data;
return http_decoder_half_data_get_decompress_body(res_data, body);
}
+#endif
static struct http_decoder_exdata *httpd_session_exdata_new(struct session *sess, struct http_decoder_env *httpd_env,
long long req_start_seq, long long res_start_seq)
@@ -619,10 +649,7 @@ extern "C"
{
http_decoder_stat_update(&httpd_env->hd_stat, thread_id, HTTPD_STAT_ASYMMETRY_SESSION_S2C, 1);
}
- else
- {
- http_decoder_stat_update(&httpd_env->hd_stat, thread_id, HTTPD_STAT_SESSION_FREE, 1);
- }
+ http_decoder_stat_update(&httpd_env->hd_stat, thread_id, HTTPD_STAT_SESSION_FREE, 1);
}
static void http_decoder_execute(struct session *sess, struct http_decoder_env *httpd_env, http_decoder_exdata *exdata, const char *payload, uint16_t payload_len)
@@ -650,7 +677,7 @@ extern "C"
http_decoder_stat_update(&httpd_env->hd_stat, thread_id, HTTPD_STAT_TCP_SEG_S2C, 1);
}
- http_decoder_half_reinit(cur_half, exdata->queue, exdata->mempool, sess);
+ http_decoder_half_reinit(cur_half, exdata->queue, exdata->mempool, sess);
int ret = http_decoder_half_parse(httpd_env->hd_cfg.proxy_enable, cur_half, payload, payload_len);
if (ret < 0)
{
@@ -1025,7 +1052,7 @@ extern "C"
}
assert(msg->ref_queue);
assert(msg->queue_index < HD_RESULT_QUEUE_LEN);
- if(msg->raw_payload.iov_base != NULL && msg->raw_payload.iov_len != 0)
+ if (msg->raw_payload.iov_base != NULL && msg->raw_payload.iov_len != 0)
{
body->iov_base = msg->raw_payload.iov_base;
body->iov_len = msg->raw_payload.iov_len;
@@ -1042,6 +1069,8 @@ extern "C"
void http_message_decompress_body_get0(const struct http_message *msg, hstring *decompress_body)
{
+ enum http_content_encoding ecode = HTTP_CONTENT_ENCODING_NONE;
+ struct http_decoder_half_data *ref_data = NULL;
int ret = -1;
if (unlikely(NULL == msg))
{
@@ -1049,12 +1078,36 @@ extern "C"
}
assert(msg->ref_queue);
assert(msg->queue_index < HD_RESULT_QUEUE_LEN);
- if(msg->decompress_payload.iov_base !=NULL && msg->decompress_payload.iov_len != 0){
+ if (msg->decompress_payload.iov_base != NULL && msg->decompress_payload.iov_len != 0)
+ {
decompress_body->iov_base = msg->decompress_payload.iov_base;
decompress_body->iov_len = msg->decompress_payload.iov_len;
return;
}
- if(msg->raw_payload.iov_base != NULL && msg->raw_payload.iov_len != 0){
+ /**
+ * @brief If the body hasn't been compressed, same as http_message_raw_body_get0().
+ *
+ */
+
+ if (HTTP_MESSAGE_REQ_BODY_START == msg->type
+ || HTTP_MESSAGE_REQ_BODY == msg->type
+ || HTTP_MESSAGE_REQ_BODY_END == msg->type)
+ {
+ ref_data = msg->ref_queue->array[msg->queue_index].req_data;
+ }
+ else if (HTTP_MESSAGE_RES_BODY_START == msg->type
+ || HTTP_MESSAGE_RES_BODY == msg->type
+ || HTTP_MESSAGE_RES_BODY_END == msg->type)
+ {
+ ref_data = msg->ref_queue->array[msg->queue_index].res_data;
+ }
+ ecode = http_half_data_get_content_encoding(ref_data);
+ if(ref_data != NULL && HTTP_CONTENT_ENCODING_NONE != ecode){
+ goto fail;
+ }
+
+ if (msg->raw_payload.iov_base != NULL && msg->raw_payload.iov_len != 0)
+ {
decompress_body->iov_base = msg->raw_payload.iov_base;
decompress_body->iov_len = msg->raw_payload.iov_len;
}
diff --git a/src/http_decoder_half.cpp b/src/http_decoder_half.cpp
index c4356fd..f766e66 100644
--- a/src/http_decoder_half.cpp
+++ b/src/http_decoder_half.cpp
@@ -4,6 +4,14 @@
#include <arpa/inet.h>
#include "http_decoder_inc.h"
#include "llhttp.h"
+#include "uthash/utlist.h"
+
+struct http_decompress_buffer
+{
+ struct iovec iov;
+ char is_commit;
+ struct http_decompress_buffer *next, *prev;
+};
struct http_decoder_half_data
{
@@ -17,9 +25,12 @@ struct http_decoder_half_data
enum http_content_encoding content_encoding;
struct http_content_decompress *decompress;
+#if 0
char *ref_decompress_body;
size_t decompress_body_len;
-
+#else
+ struct http_decompress_buffer *decompress_buffer_list;
+#endif
int joint_url_complete;
int url_is_encoded;
hstring joint_url; // http://<host>[:<port>]/<path>?<searchpart>
@@ -69,6 +80,48 @@ static void printf_debug_info(const char *desc, const char *at, size_t length)
#define printf_debug_info(desc, at, length)
#endif
+void http_half_decompress_buffer_free(struct http_decoder_half_data *data, hstring *decompress_body)
+{
+ struct http_decompress_buffer *el, *tmp;
+ DL_FOREACH_SAFE(data->decompress_buffer_list, el, tmp)
+ {
+ if (el->iov.iov_base == decompress_body->iov_base
+ && el->iov.iov_len == decompress_body->iov_len)
+ {
+ DL_DELETE(data->decompress_buffer_list, el);
+ if (el->iov.iov_base)
+ {
+ FREE(el->iov.iov_base);
+ }
+ FREE(el);
+ break;
+ }
+ }
+}
+
+void http_half_get_lastest_decompress_buffer(struct http_decoder_half_data *data, hstring *decompress_body)
+{
+ if (data->content_encoding == HTTP_CONTENT_ENCODING_NONE)
+ {
+ return;
+ }
+ if (data->decompress_buffer_list == NULL)
+ {
+ decompress_body->iov_base = NULL;
+ decompress_body->iov_len = 0;
+ return;
+ }
+ if (data->decompress_buffer_list->prev->is_commit == 1)
+ {
+ decompress_body->iov_base = NULL;
+ decompress_body->iov_len = 0;
+ return;
+ }
+ decompress_body->iov_base = data->decompress_buffer_list->prev->iov.iov_base;
+ decompress_body->iov_len = data->decompress_buffer_list->prev->iov.iov_len;
+ data->decompress_buffer_list->prev->is_commit = 1;
+}
+
static void http_decoder_half_data_decompress(struct http_decoder_half_data *data)
{
assert(data);
@@ -91,14 +144,26 @@ static void http_decoder_half_data_decompress(struct http_decoder_half_data *dat
}
assert(data->decompress);
+ char *local_outdata = NULL;
+ size_t local_outdata_len = 0;
if (http_content_decompress_write(data->decompress, (char *)raw_body.iov_base,
raw_body.iov_len,
- &data->ref_decompress_body,
- &data->decompress_body_len) == -1)
+ &local_outdata,
+ &local_outdata_len) == -1)
{
// log error
http_content_decompress_destroy(data->decompress);
data->decompress = NULL;
+ return;
+ }
+
+ if(local_outdata!= NULL && local_outdata_len > 0)
+ {
+ struct http_decompress_buffer *decompress_buffer = CALLOC(struct http_decompress_buffer, 1);
+ assert(decompress_buffer);
+ decompress_buffer->iov.iov_base = local_outdata;
+ decompress_buffer->iov.iov_len = local_outdata_len;
+ DL_APPEND(data->decompress_buffer_list, decompress_buffer);
}
}
@@ -618,7 +683,7 @@ void http_decoder_half_reinit(struct http_decoder_half *half,
if (half->ref_data != NULL)
{
http_decoder_table_reinit(half->ref_data->table);
- }
+ }
half->http_ev_ctx->ref_mempool = mempool;
half->http_ev_ctx->ref_session = sess;
half->http_ev_ctx->ref_queue = queue;
@@ -790,12 +855,31 @@ http_decoder_half_data_new(nmx_pool_t *mempool)
data->status_code = -1;
data->content_encoding = HTTP_CONTENT_ENCODING_NONE;
- data->ref_decompress_body = NULL;
- data->decompress_body_len = 0;
-
+ // data->ref_decompress_body = NULL;
+ // data->decompress_body_len = 0;
+ data->decompress_buffer_list = NULL;
return data;
}
+static void http_decoder_half_decompress_buf_free(struct http_decoder_half_data *ref_data)
+{
+ if (ref_data == NULL)
+ {
+ return;
+ }
+ struct http_decompress_buffer *el, *tmp;
+ DL_FOREACH_SAFE(ref_data->decompress_buffer_list, el, tmp)
+ {
+ DL_DELETE(ref_data->decompress_buffer_list, el);
+ if (el->iov.iov_base != NULL)
+ {
+ FREE(el->iov.iov_base);
+ }
+ FREE(el);
+ }
+ ref_data->decompress_buffer_list = NULL;
+}
+
void http_decoder_half_data_free(nmx_pool_t *mempool, struct http_decoder_half_data *data)
{
if (NULL == data)
@@ -821,6 +905,7 @@ void http_decoder_half_data_free(nmx_pool_t *mempool, struct http_decoder_half_d
data->joint_url.iov_base = NULL;
data->joint_url_complete = 0;
}
+ http_decoder_half_decompress_buf_free(data);
MEMPOOL_FREE(mempool, data);
}
@@ -889,7 +974,7 @@ int http_decoder_half_data_get_raw_body(const struct http_decoder_half_data *dat
}
return http_decoder_table_get_body(data->table, body);
}
-
+#if 0
int http_decoder_half_data_get_decompress_body(const struct http_decoder_half_data *data, hstring *body)
{
if (HTTP_CONTENT_ENCODING_NONE == data->content_encoding)
@@ -901,6 +986,7 @@ int http_decoder_half_data_get_decompress_body(const struct http_decoder_half_da
body->iov_len = data->decompress_body_len;
return 0;
}
+#endif
void http_decoder_half_data_dump(struct http_decoder_half *half)
{
@@ -1121,4 +1207,13 @@ void http_half_get_max_transaction_seq(struct http_decoder_exdata *exdata, long
assert(exdata && max_req_seq && max_res_seq);
*max_req_seq = exdata->decoder->c2s_half->transaction_seq;
*max_res_seq = exdata->decoder->s2c_half->transaction_seq;
+}
+
+enum http_content_encoding http_half_data_get_content_encoding(struct http_decoder_half_data *hf_data)
+{
+ if(NULL == hf_data)
+ {
+ return HTTP_CONTENT_ENCODING_NONE;
+ }
+ return hf_data->content_encoding;
} \ No newline at end of file
diff --git a/src/http_decoder_half.h b/src/http_decoder_half.h
index 9ea5169..ba79bc6 100644
--- a/src/http_decoder_half.h
+++ b/src/http_decoder_half.h
@@ -79,7 +79,8 @@ int http_decoder_half_data_has_parsed_header(struct http_decoder_half_data *data
int http_decoder_half_data_get_raw_body(const struct http_decoder_half_data *data, hstring *body);
int http_decoder_half_data_get_decompress_body(const struct http_decoder_half_data *data, hstring *body);
-
+void http_half_get_lastest_decompress_buffer(struct http_decoder_half_data *data, hstring *decompress_body);
+void http_half_decompress_buffer_free(struct http_decoder_half_data *data, hstring *decompress_body);
void http_decoder_half_data_dump(struct http_decoder_half *half);
void http_decoder_get_host_feed_url(struct http_decoder_half *half);
@@ -98,5 +99,7 @@ void http_half_data_update_commit_index(struct http_decoder_half_data * half_dat
void http_half_pre_context_free(struct session *sess, struct http_decoder_exdata *exdata);
void http_half_update_state(struct http_decoder_half_data *hf_data, enum http_event state);
int http_half_data_get_total_parsed_header_count(struct http_decoder_half_data * half_data);
-void http_half_get_max_transaction_seq(struct http_decoder_exdata *exdata, long long *max_req_seq, long long *max_res_seq);
+void http_half_get_max_transaction_seq(struct http_decoder_exdata *exdata, long long *max_req_seq, long long *max_res_seq);
+
+enum http_content_encoding http_half_data_get_content_encoding(struct http_decoder_half_data *hf_data);
#endif \ No newline at end of file
diff --git a/src/http_decoder_stat.cpp b/src/http_decoder_stat.cpp
index 160353b..f616658 100644
--- a/src/http_decoder_stat.cpp
+++ b/src/http_decoder_stat.cpp
@@ -12,6 +12,8 @@ static const struct hd_stat_config_tuple g_httpd_stat_tuple[HTTPD_STAT_MAX] =
{HTTPD_STAT_TCP_SEG_S2C, "tcp_seg_s2c"},
{HTTPD_STAT_HEADERS_C2S, "headers_c2s"},
{HTTPD_STAT_HEADERS_S2C, "headers_s2c"},
+ {HTTPD_STAT_ZIP_BYTES, "zip_bytes"},
+ {HTTPD_STAT_UNZIP_BYTES, "unzip_bytes"},
{HTTPD_STAT_URL_BYTES, "url_bytes"},
{HTTPD_STAT_SESSION_NEW, "session_new"},
{HTTPD_STAT_SESSION_FREE, "session_free"},
@@ -55,6 +57,10 @@ static void *httpd_stat_timer_thread(void *arg)
int http_decoder_stat_init(struct http_decoder_stat *hd_stat, int thread_max, int stat_interval_pkts, int stat_interval_time)
{
assert(sizeof(g_httpd_stat_tuple)/sizeof(struct hd_stat_config_tuple) == HTTPD_STAT_MAX);
+ if(sizeof(g_httpd_stat_tuple)/sizeof(struct hd_stat_config_tuple) != HTTPD_STAT_MAX){
+ fprintf(stderr, "enum http_decoder_stat_type number not match with g_httpd_stat_tuple!");
+ return -1;
+ }
hd_stat->fse = fieldstat_easy_new(thread_max, "http_decoder_statistics", NULL, 0);
if (NULL == hd_stat->fse)
{
diff --git a/src/http_decoder_stat.h b/src/http_decoder_stat.h
index 0376d95..719e6a0 100644
--- a/src/http_decoder_stat.h
+++ b/src/http_decoder_stat.h
@@ -10,6 +10,8 @@ enum http_decoder_stat_type
HTTPD_STAT_TCP_SEG_S2C,
HTTPD_STAT_HEADERS_C2S,
HTTPD_STAT_HEADERS_S2C,
+ HTTPD_STAT_ZIP_BYTES, //only if Content-Encoding is gzip, deflate, br
+ HTTPD_STAT_UNZIP_BYTES, //only if Content-Encoding is gzip, deflate, br
HTTPD_STAT_URL_BYTES,
HTTPD_STAT_SESSION_NEW,
HTTPD_STAT_SESSION_FREE,
diff --git a/test/http_pcap/http_gzip_out_of_order.pcap b/test/http_pcap/http_gzip_out_of_order.pcap
index ac62766..b3bb169 100644
--- a/test/http_pcap/http_gzip_out_of_order.pcap
+++ b/test/http_pcap/http_gzip_out_of_order.pcap
Binary files differ
diff --git a/test/http_pcap/http_out_of_order.pcap b/test/http_pcap/http_out_of_order.pcap
index e72edc7..7a40e5b 100644
--- a/test/http_pcap/http_out_of_order.pcap
+++ b/test/http_pcap/http_out_of_order.pcap
Binary files differ
diff --git a/test/test_result_json/http_gzip_out_of_order.json b/test/test_result_json/http_gzip_out_of_order.json
index 1fbb228..1952b9d 100644
--- a/test/test_result_json/http_gzip_out_of_order.json
+++ b/test/test_result_json/http_gzip_out_of_order.json
@@ -33,7 +33,7 @@
"Content-type": "text/html; charset=utf-8",
"Content-Encoding": "gzip",
"Content-length": "28425",
- "__X_HTTP_RAW_PAYLOAD_MD5": "873ed9c8c691a5f9f144fbf0fbfca011md5su",
+ "__X_HTTP_RAW_PAYLOAD_MD5": "873ed9c8c691a5f9f144fbf0fbfca011",
"__X_HTTP_DECOMPRESS_PAYLOAD_MD5": "7047cf4ae8ce6fd7bcd363e2b626f338"
}
] \ No newline at end of file
diff --git a/test/test_result_json/http_out_of_order.json b/test/test_result_json/http_out_of_order.json
index f0e9b85..489b7c1 100644
--- a/test/test_result_json/http_out_of_order.json
+++ b/test/test_result_json/http_out_of_order.json
@@ -38,6 +38,7 @@
"Keep-Alive": "timeout=120, max=1000",
"Connection": "Keep-Alive",
"Content-Type": "image/jpeg",
- "__X_HTTP_DECOMPRESS_PAYLOAD_MD5": "c4c9d459415e922f877a2af6afd9d316"
+ "__X_HTTP_RAW_PAYLOAD_MD5": "c4c9d459415e922f877a2af6afd9d316",
+ "__X_HTTP_DECOMPRESS_PAYLOAD_MD5": "c4c9d459415e922f877a2af6afd9d316"
}
] \ No newline at end of file
diff --git a/test_based_on_stellar/env/stellar.toml b/test_based_on_stellar/env/stellar.toml
index 496324f..9e11af5 100644
--- a/test_based_on_stellar/env/stellar.toml
+++ b/test_based_on_stellar/env/stellar.toml
@@ -28,30 +28,30 @@ tcp_overload_evict_old_sess = 1 # 1: evict old session, 0: bypass new session
udp_overload_evict_old_sess = 1 # 1: evict old session, 0: bypass new session
# TCP timeout
-tcp_init_timeout = 100 # range: [1, 60000] (ms)
-tcp_handshake_timeout = 100 # range: [1, 60000] (ms)
-tcp_data_timeout = 100 # range: [1, 15999999000] (ms)
-tcp_half_closed_timeout = 100 # range: [1, 604800000] (ms)
-tcp_time_wait_timeout = 100 # range: [1, 600000] (ms)
-tcp_discard_timeout = 100 # range: [1, 15999999000] (ms)
-tcp_unverified_rst_timeout = 100 # range: [1, 600000] (ms)
+tcp_init_timeout = 10 # range: [1, 60000] (ms)
+tcp_handshake_timeout = 10 # range: [1, 60000] (ms)
+tcp_data_timeout = 10 # range: [1, 15999999000] (ms)
+tcp_half_closed_timeout = 10 # range: [1, 604800000] (ms)
+tcp_time_wait_timeout = 10 # range: [1, 600000] (ms)
+tcp_discard_timeout = 10 # range: [1, 15999999000] (ms)
+tcp_unverified_rst_timeout = 10 # range: [1, 600000] (ms)
# UDP timeout
-udp_data_timeout = 100 # range: [1, 15999999000] (ms)
-udp_discard_timeout = 100 # range: [1, 15999999000] (ms)
+udp_data_timeout = 10 # range: [1, 15999999000] (ms)
+udp_discard_timeout = 10 # range: [1, 15999999000] (ms)
# duplicate packet filter
duplicated_packet_filter_enable = 0
duplicated_packet_filter_capacity = 1000000 # range: [1, 4294967295]
-duplicated_packet_filter_timeout = 10000 # range: [1, 60000] (ms)
+duplicated_packet_filter_timeout = 10 # range: [1, 60000] (ms)
duplicated_packet_filter_error_rate = 0.00001 # range: [0.0, 1.0]
# evicted session filter
evicted_session_filter_enable = 0
evicted_session_filter_capacity = 1000000 # range: [1, 4294967295]
-evicted_session_filter_timeout = 10000 # range: [1, 60000] (ms)
+evicted_session_filter_timeout = 10 # range: [1, 60000] (ms)
evicted_session_filter_error_rate = 0.00001 # range: [0.0, 1.0]
# TCP reassembly (Per direction)
tcp_reassembly_enable = 1
-tcp_reassembly_max_timeout = 100 # range: [1, 60000] (ms)
+tcp_reassembly_max_timeout = 10 # range: [1, 60000] (ms)
tcp_reassembly_max_segments = 256 # range: [2, 4096]