diff options
| author | 李舒 <[email protected]> | 2021-06-21 03:39:39 +0000 |
|---|---|---|
| committer | 李舒 <[email protected]> | 2021-06-21 03:39:39 +0000 |
| commit | 175026ce16ec1af06fe8ebdb28378f81139155ed (patch) | |
| tree | 3d46f8673dc9bf51525584805349e5a4febab514 /src/HTTP_Message_Entry.c | |
| parent | 1a428ed842873d2a80ea09443bd17e6a316da51f (diff) | |
| parent | dd10be9f413e6a660d3a43ebd2d8ea566d8e94ee (diff) | |
Merge branch 'http_head_s2c' into 'master'
处理s2c单向流下,响应体对应的是HEAD方法。
See merge request MESA_Platform/http!10
Diffstat (limited to 'src/HTTP_Message_Entry.c')
| -rw-r--r-- | src/HTTP_Message_Entry.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/src/HTTP_Message_Entry.c b/src/HTTP_Message_Entry.c index 032db19..c7329c9 100644 --- a/src/HTTP_Message_Entry.c +++ b/src/HTTP_Message_Entry.c @@ -463,7 +463,7 @@ uchar http_doWithEntity(http_parser_t *cur_http_node, http_stream *a_http_stream else if(a_http_stream->is_proxy) { rec = http_doWithProxyData(cur_http_node, a_http_stream,a_tcp,thread_seq, a_packet); - } + } else { rec = http_doWithDefaultData(cur_http_node, a_http_stream, a_tcp,thread_seq, a_packet); @@ -548,7 +548,7 @@ uchar http_judgeResponseEntityPresent(http_parser_t *a_http, http_stream* a_htt http_callPlugin(a_http, a_tcp, thread_seq, a_packet); } return ERROR; - } + } return OK; }/*http_judgeResponseEntityPresent*/ @@ -566,6 +566,23 @@ uchar http_judgeEntityPresent(http_parser_t *cur_http_node, http_stream *a_http_ return rec; } +void http_s2cHead(http_parser_t *cur_http_node, http_stream *a_http_stream, struct streaminfo *a_tcp, int thread_seq, void *a_packet) +{ + struct tcpdetail *tcp_detail = (struct tcpdetail*)a_tcp->pdetail; + uint32* offset = &(cur_http_node->processed_offset); + char* cur_data = (char*)(tcp_detail->pdata); + uchar method = HTTP_METHOD_UNKNOWN; + uint32 len = tcp_detail->datalen - *offset; + + if(len>HTTP_START_FLAGS_LEN) + { + if(OK==http_judgeHttpMethod(&method, cur_data+*offset, a_http_stream->res_req)) + { + cur_http_node->packet_entity_len = 0; + } + } +} + uchar http_findAndDoWithEntity(uchar* msg_status, http_parser_t *a_http, http_stream* a_http_stream, struct streaminfo *a_tcp, int thread_seq, void *a_packet) { uchar rec = OK; @@ -595,6 +612,11 @@ uchar http_findAndDoWithEntity(uchar* msg_status, http_parser_t *a_http, http_st if(a_http->parser.http_state==HTTP_DATA) { + /*20210618 S2C but maybe head*/ + if (g_http_prog_para.s2c_head_check_switch && DIR_S2C==a_http_stream->dir && 200==(a_http->parser.res_code) && 0!=a_http->parser.cont_length) + { + http_s2cHead(a_http, a_http_stream, a_tcp, thread_seq, a_packet); + } rec = http_doWithEntity(a_http, a_http_stream, a_tcp, thread_seq, a_packet); http_updatePktOffset(a_http, a_http_stream, a_tcp); *msg_status = a_http->mgs_status; |
