nghttp: Fix bug that upgrade fails if reason-phrase is missing

This commit is contained in:
Tatsuhiro Tsujikawa 2017-06-28 01:00:01 +09:00
parent 0f6d76a501
commit 18dd20ce55
1 changed files with 2 additions and 9 deletions

View File

@ -404,17 +404,10 @@ int htp_msg_begincb(http_parser *htp) {
} }
} // namespace } // namespace
namespace {
int htp_statuscb(http_parser *htp, const char *at, size_t length) {
auto client = static_cast<HttpClient *>(htp->data);
client->upgrade_response_status_code = htp->status_code;
return 0;
}
} // namespace
namespace { namespace {
int htp_msg_completecb(http_parser *htp) { int htp_msg_completecb(http_parser *htp) {
auto client = static_cast<HttpClient *>(htp->data); auto client = static_cast<HttpClient *>(htp->data);
client->upgrade_response_status_code = htp->status_code;
client->upgrade_response_complete = true; client->upgrade_response_complete = true;
return 0; return 0;
} }
@ -424,7 +417,7 @@ namespace {
constexpr http_parser_settings htp_hooks = { constexpr http_parser_settings htp_hooks = {
htp_msg_begincb, // http_cb on_message_begin; htp_msg_begincb, // http_cb on_message_begin;
nullptr, // http_data_cb on_url; nullptr, // http_data_cb on_url;
htp_statuscb, // http_data_cb on_status; nullptr, // http_data_cb on_status;
nullptr, // http_data_cb on_header_field; nullptr, // http_data_cb on_header_field;
nullptr, // http_data_cb on_header_value; nullptr, // http_data_cb on_header_value;
nullptr, // http_cb on_headers_complete; nullptr, // http_cb on_headers_complete;