From f1d8547b2923007d2a4095bb75d88f09000bd40b Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Mon, 13 Jul 2020 23:39:17 +0900 Subject: [PATCH] nghttpx: Fix stall when TLS follows after proxy protocol This fixes that nghttpx stalls when TLS handshake and data follow after proxy protocol header and no extra read notification is triggered (e.g., just small 1 HTTP request). --- src/shrpx_rate_limit.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/shrpx_rate_limit.cc b/src/shrpx_rate_limit.cc index f05ae64c..8e3134d3 100644 --- a/src/shrpx_rate_limit.cc +++ b/src/shrpx_rate_limit.cc @@ -108,7 +108,8 @@ void RateLimit::stopw() { } void RateLimit::handle_tls_pending_read() { - if (!conn_ || !conn_->tls.ssl || !conn_->tls.initial_handshake_done || + if (!conn_ || !conn_->tls.ssl || + (conn_->tls.rbuf.rleft() == 0 && !conn_->tls.initial_handshake_done) || (SSL_pending(conn_->tls.ssl) == 0 && conn_->tls.rbuf.rleft() == 0 && conn_->tls.earlybuf.rleft() == 0)) { return;