diff options
| author | luqiuwen <[email protected]> | 2019-09-09 15:35:40 +0800 |
|---|---|---|
| committer | 陆秋文 <[email protected]> | 2019-09-10 11:54:24 +0800 |
| commit | 18be5ab07f597760e5d9bb2405aaa37d830d8ef8 (patch) | |
| tree | ad5d2e9790ec839d42854da911ae662f72aae0f8 /plugin | |
| parent | f76720753cbeb751a408446c897eae45bceb1c92 (diff) | |
修正HTTP解析层在上层设置请求/应答后,需要等待源站消息完整后才将上层构建的请求/应答发出的问题。
* 现修正,每次调用HTTP解析函数后,无论是否到达消息边界,都检查是否上层是否构建了请求/应答。
Diffstat (limited to 'plugin')
| -rw-r--r-- | plugin/protocol/http/src/http_entry.cpp | 21 | ||||
| -rw-r--r-- | 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; } |
