Close #76 修正HTTP Upgrade后没有正确Detach该连接的问题

* 原实现没有正确处理Upgrade标志位,导致连接再次进入HTTP解析流程从而无法解析,报#76所列之问题。
* 现修正,亦增加#76所示日志之五元组信息。
This commit is contained in:
Lu Qiuwen
2018-11-22 13:47:17 +08:00
parent 2a91b1b954
commit fbff32673f
2 changed files with 27 additions and 20 deletions

View File

@@ -89,7 +89,7 @@ int http_plugin_init(struct tfe_proxy * proxy)
plugin_ctx->gc_event_hs_private[thread_id] = gc_event;
}
plugin_ctx->access_logger = MESA_create_runtime_log_handle("log/http-access.log", RLOG_LV_INFO);
plugin_ctx->access_logger = MESA_create_runtime_log_handle("log/http.log", RLOG_LV_INFO);
assert(plugin_ctx->access_logger != NULL);
return 0;
@@ -419,6 +419,11 @@ enum tfe_stream_action http_connection_entry(const struct tfe_stream * stream, e
return ACTION_DEFER_DATA;
}
if (hf_private_in->is_upgrade || hf_private_in->is_passthrough)
{
goto __passthrough;
}
/* Need more data, no boundary touched */
if (ret == 0)
{
@@ -431,18 +436,14 @@ enum tfe_stream_action http_connection_entry(const struct tfe_stream * stream, e
return hf_private_in->stream_action;
}
if (ret == -1 && hf_private_in->is_passthrough)
{
goto __passthrough;
}
/* Some kind of error happened, write log and detach the stream */
if (ret == -1)
{
TFE_STREAM_LOG_ERROR(stream, "Failed at parsing stream as HTTP: %u, %s, %s",
hf_private_in->parse_errno, http_errno_name(hf_private_in->parse_errno),
TFE_LOG_ERROR(g_http_plugin->access_logger, "%s: Failed at parsing stream as HTTP, %u, %s, %s",
stream->str_stream_info, hf_private_in->parse_errno, http_errno_name(hf_private_in->parse_errno),
http_errno_description(hf_private_in->parse_errno));
tfe_hexdump2file(stderr, "Failed at parsing stream as HTTP", data, (unsigned int)len);
goto __passthrough;
}