From 64d6022fa76ba779cc9b2cc6bc2940e66a28b7bf Mon Sep 17 00:00:00 2001 From: Lu Date: Mon, 20 Aug 2018 15:46:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0HTTP=E4=B8=9A=E5=8A=A1?= =?UTF-8?q?=E5=B1=82=E3=80=81=E8=A7=A3=E6=9E=90=E5=B1=82Suspend=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E5=AE=9A=E4=B9=89=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/include/tfe_http.h | 45 ++++++++++++++++++++++++++++++++----- common/include/tfe_stream.h | 2 ++ platform/CMakeLists.txt | 3 +++ platform/src/tfe_stream.cpp | 10 +++++---- 4 files changed, 50 insertions(+), 10 deletions(-) diff --git a/common/include/tfe_http.h b/common/include/tfe_http.h index b3e34ed..3452088 100644 --- a/common/include/tfe_http.h +++ b/common/include/tfe_http.h @@ -1,4 +1,6 @@ -#include "tfe_connection.h" + +#include +#include #include struct tfe_http_req_spec @@ -16,8 +18,10 @@ struct tfe_http_resp_spec int minor_version; //HTTP 1.1 or 1.0 char* content_encoding; }; + #define HTTP_REQUEST 1 #define HTTP_RESPONSE 2 + struct tfe_http_half { int direction; //HTTP_REQUEST or HTTP_RESPONSE @@ -33,6 +37,7 @@ struct tfe_http_half struct evbuffer *body; void * fields; //hide by protocol layer }; + struct tfe_http_session { int session_sequence;//? @@ -41,6 +46,7 @@ struct tfe_http_session struct tfe_http_half* resp;//value is NULL before response received. void* proto_spec; }; + enum tfe_http_std_field { HTTP_UNKNOWN_FIELD=0, @@ -73,6 +79,7 @@ enum tfe_http_std_field HTTP_X_FLASH_VERSION, HTTP_TRANSFER_LENGTH }; + struct http_field_name { enum tfe_http_std_field field_id; @@ -117,7 +124,7 @@ enum http_ev_bit_number #define EV_HTTP_REQ_BODY_BEGIN ((uint64_t)1<calling_idx=i; plug_ctx=_stream->plug_ctx+i; - if(_stream->is_fisrt_read==1) + if(_stream->is_first_read==1) { action_tmp=plugins[i].on_open(&_stream.head, _stream->thrmgr_ref->thread_id, dir, contiguous_data,contigous_len, &(plug_ctx->pme)); - _stream->is_fisrt_read=0; + _stream->is_first_read=0; } else { @@ -248,6 +249,7 @@ static void tfe_stream_readcb(struct bufferevent * bev, void * arg) } } switch (action_final) + { case ACTION_FORWARD_DATA: if(_stream->forward_bytes>0) @@ -501,7 +503,7 @@ struct tfe_stream_private* tfe_stream_create(evutil_socket_t fd_downstream, evut conn_private->fd_downstream=fd_downstream; conn_private->fd_upstream=fd_upstream; conn_private->thrmgr_ref=thread; - conn_private->is_fisrt_read=1; + conn_private->is_first_read=1; conn_public=&(conn_private->head); addr_sock2layer(conn_public->downstream.addr,peeraddr,peeraddrlen); thread->stat.value[STREAM_NUM]++;