From c967080bc575aa2b3f934cce15ee03fe43ad9638 Mon Sep 17 00:00:00 2001 From: Susan Hinrichs Date: Mon, 8 Mar 2021 22:28:12 -0600 Subject: [PATCH] Fix the final consumer write size from unchunked to chunked tunnel (#7577) (cherry picked from commit 8977a45054302b37bcc0d0a1cca3ad2dae98df6a) --- proxy/http/HttpTunnel.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/proxy/http/HttpTunnel.cc b/proxy/http/HttpTunnel.cc index 5ac2e734558..1f7d210c572 100644 --- a/proxy/http/HttpTunnel.cc +++ b/proxy/http/HttpTunnel.cc @@ -1057,16 +1057,18 @@ HttpTunnel::producer_handler_dechunked(int event, HttpTunnelProducer *p) // We only interested in translating certain events switch (event) { - case VC_EVENT_READ_READY: case VC_EVENT_READ_COMPLETE: case HTTP_TUNNEL_EVENT_PRECOMPLETE: case VC_EVENT_EOS: + p->alive = false; // Update the producer state for final_consumer_bytes_to_write + /* fallthrough */ + case VC_EVENT_READ_READY: p->last_event = p->chunked_handler.last_server_event = event; if (p->chunked_handler.generate_chunked_content()) { // We are done, make sure the consumer is activated HttpTunnelConsumer *c; for (c = p->consumer_list.head; c; c = c->link.next) { if (c->alive) { - c->write_vio->nbytes = p->chunked_handler.chunked_size; + c->write_vio->nbytes = final_consumer_bytes_to_write(p, c); // consumer_handler(VC_EVENT_WRITE_COMPLETE, c); } }