From a3ebeeafbab4c871a7856e2a6e4fdde497b24060 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Fri, 1 Dec 2017 22:27:16 +0900 Subject: [PATCH] nghttpx: Fix crash with --backend-http-proxy-uri option --- src/shrpx_http2_session.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/shrpx_http2_session.cc b/src/shrpx_http2_session.cc index a4ab465f..84552fce 100644 --- a/src/shrpx_http2_session.cc +++ b/src/shrpx_http2_session.cc @@ -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;