From 5bff48a15a0bf6f2d6f48eb10cb6839e5fcc662d Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Wed, 17 Sep 2014 22:36:42 +0900 Subject: [PATCH] nghttpx: Call upstream resume_read after sending pending request to backend With the combination of HTTP/1 upstream and HTTP/2 downstream, downstream tells SHRPX_NO_BUFFER while connecting to the backend server. Previously, we did not call upstream resume_read and upload was blocked. This commit now calls upstream resume_read to unblock. This commit also remove pending output buffer size of Http2Session when calculating downstream connection's buffer is full. This is desirable since we only operate resume_read by stream basis. --- src/shrpx_http2_downstream_connection.cc | 2 +- src/shrpx_http2_session.cc | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/shrpx_http2_downstream_connection.cc b/src/shrpx_http2_downstream_connection.cc index 99a3528b..3ed0a6de 100644 --- a/src/shrpx_http2_downstream_connection.cc +++ b/src/shrpx_http2_downstream_connection.cc @@ -583,7 +583,7 @@ StreamData* Http2DownstreamConnection::detach_stream_data() bool Http2DownstreamConnection::get_output_buffer_full() { if(request_body_buf_) { - return http2session_->get_outbuf_length() + + return evbuffer_get_length(request_body_buf_) >= Http2Session::OUTBUF_MAX_THRES; } else { return false; diff --git a/src/shrpx_http2_session.cc b/src/shrpx_http2_session.cc index eb4ef3b5..a557ed78 100644 --- a/src/shrpx_http2_session.cc +++ b/src/shrpx_http2_session.cc @@ -1471,6 +1471,9 @@ int Http2Session::on_connect() // submit pending request for(auto dconn : dconns_) { if(dconn->push_request_headers() == 0) { + auto downstream = dconn->get_downstream(); + auto upstream = downstream->get_upstream(); + upstream->resume_read(SHRPX_NO_BUFFER, downstream, 0); continue; }