diff options
| author | lishu <[email protected]> | 2019-01-28 18:22:58 +0800 |
|---|---|---|
| committer | lishu <[email protected]> | 2019-01-28 18:22:58 +0800 |
| commit | d46db5643ed4981ae03f42689deb1ba1390f3e60 (patch) | |
| tree | 5076da6aad2e57d27ad5f906187ce72695106c9f /src | |
| parent | 45ff1450cd33ecb44f1787fab4fa878cc3cd8c9b (diff) | |
1. 支持 Content-Range: bytes -154100106/154100107的解析
2. bug修复:http_doWithGzipData
3. 增加assert(session_info.buflen>=0);
Diffstat (limited to 'src')
| -rw-r--r-- | src/HTTP_Analyze.c | 6 | ||||
| -rw-r--r-- | src/HTTP_Message_Entry.c | 8 | ||||
| -rw-r--r-- | src/HTTP_Message_Region.c | 20 |
3 files changed, 24 insertions, 10 deletions
diff --git a/src/HTTP_Analyze.c b/src/HTTP_Analyze.c index 001ce48..60ac353 100644 --- a/src/HTTP_Analyze.c +++ b/src/HTTP_Analyze.c @@ -25,7 +25,7 @@ http_prog_runtime_parameter_t g_http_prog_para; int G_HTTP_H_VERSION_3_20150320 = 0; -int G_HTTP_VERSION_4_20190111 = 0; +int G_HTTP_VERSION_4_20190128 = 0; void history() { //2014-12-09 V3.0 new documentAnalyze lib ; http.h add and delete ; @@ -100,6 +100,7 @@ void history() //2018-11-13 V4.0 //special http pkt, proc span //2019-01-05 V4.0 //special http packet, get_span_space.pcap //2019-01-11 V4.0 //is_absolute_uri + //2019-01-28 V4.0 //1. support Content-Range: bytes -154100106/154100107 2. bug:http_doWithGzipData 3. assert(session_info.buflen>=0); } /* @@ -183,7 +184,8 @@ void http_callPluginField(http_parser_t* cur_http_node,struct streaminfo *a_tcp, session_info._pad_ = 0; session_info.app_info = (void*)(&(cur_http_node->parser)); session_info.buf = (void*)(cur_http_node->session.buf); - session_info.buflen = cur_http_node->session.buflen; + session_info.buflen = cur_http_node->session.buflen; + assert(session_info.buflen>=0); cur_http_node->business.return_value = PROT_PROCESS(&session_info, &(cur_http_node->business.param), thread_seq,a_tcp, a_packet); diff --git a/src/HTTP_Message_Entry.c b/src/HTTP_Message_Entry.c index 1365648..e474f2a 100644 --- a/src/HTTP_Message_Entry.c +++ b/src/HTTP_Message_Entry.c @@ -80,11 +80,11 @@ void http_doWithGzipData(http_parser_t *cur_http_node, struct streaminfo *a_tcp, cur_http_node->session.buflen = 0; for (int k=0; k < result_array->result_num; k++) { - cur_http_node->session.buf = (char*)dictator_realloc(thread_seq, cur_http_node->session.buf,cur_http_node->session.buflen+result_array->result_buff->size); + cur_http_node->session.buf = (char*)dictator_realloc(thread_seq, cur_http_node->session.buf,cur_http_node->session.buflen+result_array->result_buff[k].size); memcpy(cur_http_node->session.buf+cur_http_node->session.buflen, - result_array->result_buff->presult, - result_array->result_buff->size); - cur_http_node->session.buflen += result_array->result_buff->size; + result_array->result_buff[k].presult, + result_array->result_buff[k].size); + cur_http_node->session.buflen += result_array->result_buff[k].size; } FLAG_SET(cur_http_node->flag, HTTP_FLAG_BATCH_CALLBACK); http_callPlugin(cur_http_node, a_tcp, thread_seq, a_packet); diff --git a/src/HTTP_Message_Region.c b/src/HTTP_Message_Region.c index 45b6f78..57c0440 100644 --- a/src/HTTP_Message_Region.c +++ b/src/HTTP_Message_Region.c @@ -249,6 +249,10 @@ uchar http_doWithContentLength(http_parser_t* a_http, http_stream *a_http_stream return OK; } +/* +example: +Content-Range: bytes -154100106/154100107 +*/ uchar http_doWithContentRange(http_parser_t* a_http, http_stream *a_http_stream, char* value, uint32 valuelen, struct streaminfo *a_tcp, int thread_seq, void *a_packet) { @@ -259,7 +263,7 @@ uchar http_doWithContentRange(http_parser_t* a_http, http_stream *a_http_stream, /*only get digit*/ for(i=0;i<valuelen;i++) { - if( *(value+i)>='0' && *(value+i)<='9' ) + if( *(value+i)>='0' && *(value+i)<='9' || *(value+i)=='-') { digit = value+i; break; @@ -272,10 +276,18 @@ uchar http_doWithContentRange(http_parser_t* a_http, http_stream *a_http_stream, return ERROR; } a_http->parser.cont_range = (cont_range_t*)dictator_malloc(thread_seq, sizeof(cont_range_t)); - //memset(cur_http_node->parser.cont_range, 0, sizeof(cur_http_node->parser.cont_range)); - memcpy(range, digit, MIN(HTTP_MAX_UINT64_LEN-1,valuelen)); + /*20190128 bytes -154100106/154100107*/ + if(*digit=='-') + { + range[0] = '0'; + memcpy(range+1, digit, MIN(HTTP_MAX_UINT64_LEN-1,valuelen)); + } + else + { + memcpy(range, digit, MIN(HTTP_MAX_UINT64_LEN-1,valuelen)); + } rec = sscanf(range, "%llu-%llu/%llu", &(a_http->parser.cont_range->start), &(a_http->parser.cont_range->end), &(a_http->parser.cont_range->len)); - if(rec==-1) + if(rec!=3) { MESA_handle_runtime_log(g_http_prog_para.http_log_handle, RLOG_LV_FATAL, HTTP_PLUGIN_NAME, "content range error. addr:%s, range:%s", printaddr(&a_tcp->addr, thread_seq), range); |
