nghttpx: Fix crash with --backend-http-proxy-uri option

This commit is contained in:
Tatsuhiro Tsujikawa 2017-12-01 22:27:16 +09:00
parent 97f1735cf5
commit a3ebeeafba
1 changed files with 6 additions and 3 deletions

View File

@ -577,11 +577,11 @@ int Http2Session::initiate_connection() {
}
}
on_write_ = &Http2Session::downstream_write;
on_read_ = &Http2Session::downstream_read;
// We have been already connected when no TLS and proxy is used.
if (state_ == PROXY_CONNECTED) {
on_read_ = &Http2Session::read_noop;
on_write_ = &Http2Session::write_noop;
return connected();
}
@ -1642,6 +1642,9 @@ int Http2Session::connection_made() {
state_ = Http2Session::CONNECTED;
on_write_ = &Http2Session::downstream_write;
on_read_ = &Http2Session::downstream_read;
if (addr_->tls) {
const unsigned char *next_proto = nullptr;
unsigned int next_proto_len = 0;