summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@yahoo.com>2017-08-07 22:13:18 +0200
committerJoel Klinghed <the_jk@yahoo.com>2017-08-07 22:13:18 +0200
commit60cf4cd9b4004f21dfe187641d4bf6e05d0229f4 (patch)
treec03ba6455cbdb6d45f83841ddb8812d0c1ffe92e /src
parenta3a7cb77503bed555f6c2f2b03e42773979d4385 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/proxy.cc7
1 files changed, 7 insertions, 0 deletions
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;
}