diff --git a/plugin/protocol/http/src/http_half.cpp b/plugin/protocol/http/src/http_half.cpp index d35f507..353ba2b 100644 --- a/plugin/protocol/http/src/http_half.cpp +++ b/plugin/protocol/http/src/http_half.cpp @@ -356,8 +356,8 @@ static int __parser_callback_on_headers_complete(http_parser * parser) hf_private->stream_action = hf_private->user_stream_action; } - /* user's suspend tag is set, which indicate that the way to handle request/response - * cannot be determinate at now, need to defer */ + /* user's suspend tag is set, which indicate that the way to handle request/response + * cannot be determinate at now, need to defer */ else if (hs_private && hs_private->suspend_tag_signal) { /* Pause parser, prevent to parse request/response body, @@ -371,13 +371,23 @@ static int __parser_callback_on_headers_complete(http_parser * parser) * The request/response cannot be suspend once any bytes has been forwarded to upstream */ assert(hf_private->stream_action == ACTION_DEFER_DATA); } - - /* Otherwise, forward the request/response */ + /* Otherwise, forward the request/response */ else { 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; }