diff --git a/plugin/protocol/http/src/http_entry.cpp b/plugin/protocol/http/src/http_entry.cpp index 9d2f245..141d3ff 100644 --- a/plugin/protocol/http/src/http_entry.cpp +++ b/plugin/protocol/http/src/http_entry.cpp @@ -223,7 +223,7 @@ static int __on_request_handle_user_req_or_resp(const tfe_stream * stream, struc ret = __write_http_half_to_line(stream, CONN_DIR_UPSTREAM, hf_private_req_user); if (unlikely(ret < 0)) { - TFE_STREAM_LOG_ERROR(stream, "Failed to write HTTP request setup by user. "); + TFE_LOG_ERROR(g_http_plugin->logger, "Failed to write HTTP request setup by user. "); return ret; } @@ -246,7 +246,7 @@ static int __on_request_handle_user_req_or_resp(const tfe_stream * stream, struc if (unlikely(ret < 0)) { - TFE_STREAM_LOG_ERROR(stream, "Failed to write HTTP request setup by user."); + TFE_LOG_ERROR(g_http_plugin->logger, "Failed to write HTTP request setup by user."); goto __errout; } @@ -271,7 +271,7 @@ static int __on_response_handle_user_req_or_resp(const tfe_stream * stream, stru int ret = __write_http_half_to_line(stream, CONN_DIR_DOWNSTREAM, hf_private_resp_user); if (unlikely(ret < 0)) { - TFE_STREAM_LOG_ERROR(stream, "Failed to write HTTP response setup by user."); + TFE_LOG_ERROR(g_http_plugin->logger, "Failed to write HTTP response setup by user."); return -1; } @@ -328,7 +328,17 @@ static int __on_response_prepare_context(const struct tfe_stream * stream, unsig /* Standalone response, it means missing something or malformed http protocol */ if (hs_private == NULL) { - TFE_STREAM_LOG_ERROR(stream, "Standlone HTTP response emerged. Malformed HTTP Protocol, detached. "); + TFE_LOG_ERROR(g_http_plugin->logger, "Standlone HTTP response emerged. Malformed HTTP Protocol, detached. "); + return -1; + } + + struct http_half_private * hf_private_req_in = to_hf_request_private(hs_private); + + /* The request is not completed, but response arrival. + * Something wrong happends to server, like 502 bad gateway */ + if(hf_private_req_in->message_status != STATUS_COMPLETE) + { + TFE_LOG_ERROR(g_http_plugin->logger, "Response arrival when request is not completed, detached. "); return -1; }