From 9be4b16f0c99a8dd2e56fa5cd2a153ad5683c2a3 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Thu, 29 Jun 2023 00:30:01 +0200 Subject: HTTP: refactor: storing the body_handler as part of r. This will allow sending the header from a totally different point, since the data for the call is present in the request, which is available everywhere. It will also allow consulting in a filter if there is a body_handler installed. The gzip filter will need this, as it should be a no-op if there is no body handler installed. Signed-off-by: Alejandro Colomar Signed-off-by: Alejandro Colomar --- src/nxt_router.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/nxt_router.c') diff --git a/src/nxt_router.c b/src/nxt_router.c index 4e3cb303..f578303f 100644 --- a/src/nxt_router.c +++ b/src/nxt_router.c @@ -4190,7 +4190,8 @@ nxt_router_response_ready_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg, nxt_buf_chain_add(&r->out, b); } - nxt_http_request_header_send(task, r, nxt_http_request_send_body, NULL); + r->body_handler = nxt_http_request_send_body; + nxt_http_request_header_send(task, r); if (r->websocket_handshake && r->status == NXT_HTTP_SWITCHING_PROTOCOLS) -- cgit