Skip to content

Commit 370a382

Browse files
committed
Add server_request_body_incomplete flag to track incomplete body transfers
1 parent 551e64e commit 370a382

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

include/proxy/http/HttpSM.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,7 @@ class HttpSM : public Continuation, public PluginUserArgs<TS_USER_ARGS_TXN>
512512
int server_connection_provided_cert = 0;
513513
int64_t client_request_body_bytes = 0;
514514
int64_t server_request_body_bytes = 0;
515+
bool server_request_body_incomplete = false;
515516
int64_t server_response_body_bytes = 0;
516517
int64_t client_response_body_bytes = 0;
517518
int64_t cache_response_body_bytes = 0;

src/proxy/http/HttpSM.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2072,11 +2072,14 @@ HttpSM::state_read_server_response_header(int event, void *data)
20722072
if (tunnel.is_tunnel_alive()) {
20732073
// Record bytes already written to the server before aborting the tunnel.
20742074
// tunnel_handler_post_server() won't be called after abort, so we must
2075-
// capture this here to prevent the connection from being pooled later.
2075+
// capture this here for stats/logging purposes.
20762076
HttpTunnelConsumer *server_consumer = tunnel.get_consumer(server_txn);
20772077
if (server_consumer && server_request_body_bytes == 0) {
20782078
server_request_body_bytes = server_consumer->bytes_written;
20792079
}
2080+
// Mark the body transfer as incomplete so the origin connection is not
2081+
// pooled. The origin may have unconsumed body data in the TCP stream.
2082+
server_request_body_incomplete = true;
20802083
tunnel.abort_tunnel();
20812084
// Make sure client connection is closed when we are done in case there is cruft left over
20822085
t_state.client_info.keep_alive = HTTPKeepAlive::NO_KEEPALIVE;

0 commit comments

Comments
 (0)