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_http_static.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/nxt_http_static.c') diff --git a/src/nxt_http_static.c b/src/nxt_http_static.c index e51ba6b0..fc26924d 100644 --- a/src/nxt_http_static.c +++ b/src/nxt_http_static.c @@ -317,7 +317,6 @@ nxt_http_static_send_ready(nxt_task_t *task, void *obj, void *data) nxt_router_conf_t *rtcf; nxt_http_action_t *action; nxt_http_request_t *r; - nxt_work_handler_t body_handler; nxt_http_static_ctx_t *ctx; nxt_http_static_conf_t *conf; @@ -584,11 +583,11 @@ nxt_http_static_send_ready(nxt_task_t *task, void *obj, void *data) r->out = fb; - body_handler = &nxt_http_static_body_handler; + r->body_handler = &nxt_http_static_body_handler; } else { nxt_file_close(task, f); - body_handler = NULL; + r->body_handler = NULL; } } else { @@ -646,10 +645,10 @@ nxt_http_static_send_ready(nxt_task_t *task, void *obj, void *data) nxt_memcpy(p, r->args->start, r->args->length); } - body_handler = NULL; + r->body_handler = NULL; } - nxt_http_request_header_send(task, r, body_handler, NULL); + nxt_http_request_header_send(task, r); r->state = &nxt_http_static_send_state; return; -- cgit