add HttpMessage::is_header_complete()

This commit is contained in:
XieHan
2022-03-06 15:58:16 +08:00
parent e1899fb75b
commit 9b044eb495
2 changed files with 9 additions and 6 deletions
+4 -6
View File
@@ -342,13 +342,11 @@ void ComplexHttpTask::check_response()
resp->end_parsing();
if (this->state == WFT_STATE_SYS_ERROR && this->error == ECONNRESET)
{
const http_parser_t *parser = resp->get_parser();
/* Servers can end the message by closing the connection. */
if (http_parser_header_complete(parser) &&
!http_parser_keep_alive(parser) &&
!http_parser_chunked(parser) &&
!http_parser_has_content_length(parser))
if (resp->is_header_complete() &&
!resp->is_keep_alive() &&
!resp->is_chunked() &&
!resp->has_content_length_header())
{
this->state = WFT_STATE_SUCCESS;
this->error = 0;
+5
View File
@@ -93,6 +93,11 @@ public:
this->parser) == 0;
}
bool is_header_complete() const
{
return http_parser_header_complete(this->parser);
}
bool has_connection_header() const
{
return http_parser_has_connection(this->parser);