Merge pull request #1080 from nghttp2/nghttpx-fix-crash-with-backend-http-proxy-uri

nghttpx: Fix crash with --backend-http-proxy-uri option
This commit is contained in:
Tatsuhiro Tsujikawa 2017-12-01 23:07:38 +09:00 committed by GitHub
commit d8e378fea9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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. // We have been already connected when no TLS and proxy is used.
if (state_ == PROXY_CONNECTED) { if (state_ == PROXY_CONNECTED) {
on_read_ = &Http2Session::read_noop;
on_write_ = &Http2Session::write_noop;
return connected(); return connected();
} }
@ -1642,6 +1642,9 @@ int Http2Session::connection_made() {
state_ = Http2Session::CONNECTED; state_ = Http2Session::CONNECTED;
on_write_ = &Http2Session::downstream_write;
on_read_ = &Http2Session::downstream_read;
if (addr_->tls) { if (addr_->tls) {
const unsigned char *next_proto = nullptr; const unsigned char *next_proto = nullptr;
unsigned int next_proto_len = 0; unsigned int next_proto_len = 0;