From 18be5ab07f597760e5d9bb2405aaa37d830d8ef8 Mon Sep 17 00:00:00 2001 From: luqiuwen Date: Mon, 9 Sep 2019 15:35:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3HTTP=E8=A7=A3=E6=9E=90?= =?UTF-8?q?=E5=B1=82=E5=9C=A8=E4=B8=8A=E5=B1=82=E8=AE=BE=E7=BD=AE=E8=AF=B7?= =?UTF-8?q?=E6=B1=82/=E5=BA=94=E7=AD=94=E5=90=8E=EF=BC=8C=E9=9C=80?= =?UTF-8?q?=E8=A6=81=E7=AD=89=E5=BE=85=E6=BA=90=E7=AB=99=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E5=AE=8C=E6=95=B4=E5=90=8E=E6=89=8D=E5=B0=86=E4=B8=8A=E5=B1=82?= =?UTF-8?q?=E6=9E=84=E5=BB=BA=E7=9A=84=E8=AF=B7=E6=B1=82/=E5=BA=94?= =?UTF-8?q?=E7=AD=94=E5=8F=91=E5=87=BA=E7=9A=84=E9=97=AE=E9=A2=98=E3=80=82?= =?UTF-8?q?=20*=20=E7=8E=B0=E4=BF=AE=E6=AD=A3=EF=BC=8C=E6=AF=8F=E6=AC=A1?= =?UTF-8?q?=E8=B0=83=E7=94=A8HTTP=E8=A7=A3=E6=9E=90=E5=87=BD=E6=95=B0?= =?UTF-8?q?=E5=90=8E=EF=BC=8C=E6=97=A0=E8=AE=BA=E6=98=AF=E5=90=A6=E5=88=B0?= =?UTF-8?q?=E8=BE=BE=E6=B6=88=E6=81=AF=E8=BE=B9=E7=95=8C=EF=BC=8C=E9=83=BD?= =?UTF-8?q?=E6=A3=80=E6=9F=A5=E6=98=AF=E5=90=A6=E4=B8=8A=E5=B1=82=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E6=9E=84=E5=BB=BA=E4=BA=86=E8=AF=B7=E6=B1=82/?= =?UTF-8?q?=E5=BA=94=E7=AD=94=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin/protocol/http/src/http_entry.cpp | 21 +++++++++++---------- plugin/protocol/http/src/http_half.cpp | 11 ----------- 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/plugin/protocol/http/src/http_entry.cpp b/plugin/protocol/http/src/http_entry.cpp index 0c45447..54804fb 100644 --- a/plugin/protocol/http/src/http_entry.cpp +++ b/plugin/protocol/http/src/http_entry.cpp @@ -386,6 +386,7 @@ enum tfe_stream_action http_connection_entry(const struct tfe_stream * stream, e bool __need_to_close_the_session = false; int ret = 0; + int user_construct_ret = 0; enum tfe_stream_action __action = ACTION_FORWARD_DATA; size_t __action_args = 0; @@ -454,6 +455,16 @@ enum tfe_stream_action http_connection_entry(const struct tfe_stream * stream, e goto __passthrough; } + user_construct_ret = (dir == CONN_DIR_DOWNSTREAM) ? + __on_request_handle_user_req_or_resp(stream, hs_private, hf_private_in, __need_to_close_the_session) : + __on_response_handle_user_req_or_resp(stream, hs_private, hf_private_in, __need_to_close_the_session); + + if (user_construct_ret < 0) + { + assert(0); + goto __passthrough; + } + /* Need more data, no boundary touched */ if (ret == 0) { @@ -477,16 +488,6 @@ enum tfe_stream_action http_connection_entry(const struct tfe_stream * stream, e goto __passthrough; } - ret = (dir == CONN_DIR_DOWNSTREAM) ? - __on_request_handle_user_req_or_resp(stream, hs_private, hf_private_in, __need_to_close_the_session) : - __on_response_handle_user_req_or_resp(stream, hs_private, hf_private_in, __need_to_close_the_session); - - if (ret < 0) - { - assert(0); - goto __passthrough; - } - /* Touch a boundary, such as the end of HTTP headers, bodys, et al. */ __action_args = hf_private_in->parse_cursor; hf_private_in->parse_cursor = 0; diff --git a/plugin/protocol/http/src/http_half.cpp b/plugin/protocol/http/src/http_half.cpp index 353ba2b..8e4d61e 100644 --- a/plugin/protocol/http/src/http_half.cpp +++ b/plugin/protocol/http/src/http_half.cpp @@ -377,17 +377,6 @@ static int __parser_callback_on_headers_complete(http_parser * parser) hf_private->stream_action = ACTION_FORWARD_DATA; } - if (hs_private && hf_direction == TFE_HTTP_REQUEST && hs_private->hf_private_req_user != NULL) - { - http_parser_pause(parser, 1); - assert(hf_private->stream_action != ACTION_FORWARD_DATA); - } - else if (hs_private && hf_direction == TFE_HTTP_RESPONSE && hs_private->hf_private_resp_user != NULL) - { - http_parser_pause(parser, 1); - assert(hf_private->stream_action != ACTION_FORWARD_DATA); - } - return 0; }