summaryrefslogtreecommitdiff
path: root/src/HTTP_Message_Entry.c
diff options
context:
space:
mode:
authorlishu <[email protected]>2021-06-18 18:44:46 +0800
committerlishu <[email protected]>2021-06-18 18:44:46 +0800
commitdd10be9f413e6a660d3a43ebd2d8ea566d8e94ee (patch)
tree3d46f8673dc9bf51525584805349e5a4febab514 /src/HTTP_Message_Entry.c
parent1a428ed842873d2a80ea09443bd17e6a316da51f (diff)
处理s2c单向流下,响应体对应的是HEAD方法。
Diffstat (limited to 'src/HTTP_Message_Entry.c')
-rw-r--r--src/HTTP_Message_Entry.c26
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;