diff options
author | Alejandro Colomar <alx@nginx.com> | 2023-06-29 00:30:01 +0200 |
---|---|---|
committer | Alejandro Colomar <alx@kernel.org> | 2023-10-25 13:37:50 +0200 |
commit | 9be4b16f0c99a8dd2e56fa5cd2a153ad5683c2a3 (patch) | |
tree | 318d345a3c50d2f7a37f41c75f5730800b1f3e24 /src/nxt_http.h | |
parent | a084e2bc8066ce2fed852bf04e5168e289bf834b (diff) | |
download | unit-9be4b16f0c99a8dd2e56fa5cd2a153ad5683c2a3.tar.gz unit-9be4b16f0c99a8dd2e56fa5cd2a153ad5683c2a3.tar.bz2 |
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 <alx@nginx.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Diffstat (limited to 'src/nxt_http.h')
-rw-r--r-- | src/nxt_http.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/nxt_http.h b/src/nxt_http.h index e812bd0d..d614b303 100644 --- a/src/nxt_http.h +++ b/src/nxt_http.h @@ -140,6 +140,9 @@ struct nxt_http_request_s { nxt_buf_t *out; const nxt_http_request_state_t *state; + nxt_work_handler_t body_handler; + void *body_handler_data; + nxt_nsec_t start_time; nxt_str_t host; @@ -265,8 +268,7 @@ struct nxt_http_action_s { typedef struct { void (*body_read)(nxt_task_t *task, nxt_http_request_t *r); void (*local_addr)(nxt_task_t *task, nxt_http_request_t *r); - void (*header_send)(nxt_task_t *task, nxt_http_request_t *r, - nxt_work_handler_t body_handler, void *data); + void (*header_send)(nxt_task_t *task, nxt_http_request_t *r); void (*send)(nxt_task_t *task, nxt_http_request_t *r, nxt_buf_t *out); nxt_off_t (*body_bytes_sent)(nxt_task_t *task, nxt_http_proto_t proto); void (*discard)(nxt_task_t *task, nxt_http_request_t *r, nxt_buf_t *last); @@ -326,8 +328,7 @@ nxt_http_request_t *nxt_http_request_create(nxt_task_t *task); void nxt_http_request_error(nxt_task_t *task, nxt_http_request_t *r, nxt_http_status_t status); void nxt_http_request_read_body(nxt_task_t *task, nxt_http_request_t *r); -void nxt_http_request_header_send(nxt_task_t *task, nxt_http_request_t *r, - nxt_work_handler_t body_handler, void *data); +void nxt_http_request_header_send(nxt_task_t *task, nxt_http_request_t *r); void nxt_http_request_ws_frame_start(nxt_task_t *task, nxt_http_request_t *r, nxt_buf_t *ws_frame); void nxt_http_request_send(nxt_task_t *task, nxt_http_request_t *r, |