nghttpx: Fix crash when upgrading HTTP/2 failed
This commit is contained in:
parent
38153e0f6e
commit
185ebd7b79
|
@ -662,6 +662,7 @@ int ClientHandler::perform_http2_upgrade(HttpsUpstream *http) {
|
|||
"Upgrade: " NGHTTP2_CLEARTEXT_PROTO_VERSION_ID "\r\n"
|
||||
"\r\n";
|
||||
wb_.write(res, sizeof(res) - 1);
|
||||
signal_write();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -116,8 +116,10 @@ int Http2Upstream::upgrade_upstream(HttpsUpstream *http) {
|
|||
session_, reinterpret_cast<const uint8_t *>(settings_payload.c_str()),
|
||||
settings_payload.size(), nullptr);
|
||||
if (rv != 0) {
|
||||
ULOG(WARN, this) << "nghttp2_session_upgrade() returned error: "
|
||||
if (LOG_ENABLED(INFO)) {
|
||||
ULOG(INFO, this) << "nghttp2_session_upgrade() returned error: "
|
||||
<< nghttp2_strerror(rv);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
pre_upstream_.reset(http);
|
||||
|
|
|
@ -234,13 +234,11 @@ int htp_msg_completecb(http_parser *htp) {
|
|||
}
|
||||
|
||||
if (handler->get_http2_upgrade_allowed() &&
|
||||
downstream->get_http2_upgrade_request()) {
|
||||
|
||||
if (handler->perform_http2_upgrade(upstream) != 0) {
|
||||
return -1;
|
||||
downstream->get_http2_upgrade_request() &&
|
||||
handler->perform_http2_upgrade(upstream) != 0) {
|
||||
if (LOG_ENABLED(INFO)) {
|
||||
ULOG(INFO, upstream) << "HTTP Upgrade to HTTP/2 failed";
|
||||
}
|
||||
|
||||
handler->signal_write();
|
||||
}
|
||||
|
||||
// Stop further processing to complete this request
|
||||
|
|
Loading…
Reference in New Issue