Close #107 不能正确处理502 Bad Gateway的问题
* 修正为当HTTP请求未完成时,认为整个HTTP Session非法,不处理。
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user