From 60cf4cd9b4004f21dfe187641d4bf6e05d0229f4 Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Mon, 7 Aug 2017 22:13:18 +0200 Subject: Proxy: Make sure to check input buffer when done with request Pipelining a whole request before the current one is done would cause the proxy to not notice the second request until more data arrived --- src/proxy.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/proxy.cc b/src/proxy.cc index 5eca4fb..3582b4f 100644 --- a/src/proxy.cc +++ b/src/proxy.cc @@ -1215,6 +1215,7 @@ void ProxyImpl::close_client_when_done(size_t index) { client.pkg_id = 0; } looper_->modify(client.fd.get(), client.write_flag); + client_empty_input(index); } void ProxyImpl::client_remote_event(size_t index, int fd, uint8_t events) { @@ -1347,6 +1348,7 @@ void ProxyImpl::client_remote_event(size_t index, int fd, uint8_t events) { } close_base(&client.remote); client.remote_state = CLOSED; + client_empty_input(index); break; } return; @@ -1402,6 +1404,9 @@ void ProxyImpl::client_remote_event(size_t index, int fd, uint8_t events) { return; } client.remote.in->consume(response->size()); + if (client.remote_state == WAITING) { + client_empty_input(index); + } break; } case CONTENT_LEN: @@ -1434,6 +1439,7 @@ void ProxyImpl::client_remote_event(size_t index, int fd, uint8_t events) { client.remote.read_flag = 0; client.remote.write_flag = 0; looper_->modify(client.remote.fd.get(), 0); + client_empty_input(index); return; case CONTENT_CHUNKED: { auto used = client.remote.content.chunked->add(ptr, avail); @@ -1462,6 +1468,7 @@ void ProxyImpl::client_remote_event(size_t index, int fd, uint8_t events) { client.remote.read_flag = 0; client.remote.write_flag = 0; looper_->modify(client.remote.fd.get(), 0); + client_empty_input(index); } break; } -- cgit v1.2.3-70-g09d2