From 14e56fe8c869af490f76b7e88ac5d02a7ab4dd89 Mon Sep 17 00:00:00 2001 From: Igor Sysoev Date: Thu, 14 Nov 2019 16:39:48 +0300 Subject: Replacing pass with action. --- src/nxt_http_request.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'src/nxt_http_request.c') diff --git a/src/nxt_http_request.c b/src/nxt_http_request.c index a18a02e7..1f7a1796 100644 --- a/src/nxt_http_request.c +++ b/src/nxt_http_request.c @@ -10,7 +10,7 @@ static nxt_int_t nxt_http_validate_host(nxt_str_t *host, nxt_mp_t *mp); static void nxt_http_request_start(nxt_task_t *task, void *obj, void *data); -static void nxt_http_request_pass(nxt_task_t *task, void *obj, void *data); +static void nxt_http_request_action(nxt_task_t *task, void *obj, void *data); static void nxt_http_request_proto_info(nxt_task_t *task, nxt_http_request_t *r); static void nxt_http_request_mem_buf_completion(nxt_task_t *task, void *obj, @@ -278,33 +278,33 @@ nxt_http_request_start(nxt_task_t *task, void *obj, void *data) static const nxt_http_request_state_t nxt_http_request_body_state nxt_aligned(64) = { - .ready_handler = nxt_http_request_pass, + .ready_handler = nxt_http_request_action, .error_handler = nxt_http_request_close_handler, }; static void -nxt_http_request_pass(nxt_task_t *task, void *obj, void *data) +nxt_http_request_action(nxt_task_t *task, void *obj, void *data) { - nxt_http_pass_t *pass; + nxt_http_action_t *action; nxt_http_request_t *r; r = obj; - pass = r->conf->socket_conf->pass; + action = r->conf->socket_conf->action; - if (nxt_fast_path(pass != NULL)) { + if (nxt_fast_path(action != NULL)) { do { - nxt_debug(task, "http request route: %V", &pass->name); + nxt_debug(task, "http request route: %V", &action->name); - pass = pass->handler(task, r, pass); + action = action->handler(task, r, action); - if (pass == NULL) { + if (action == NULL) { return; } - if (pass == NXT_HTTP_PASS_ERROR) { + if (action == NXT_HTTP_ACTION_ERROR) { break; } @@ -315,13 +315,13 @@ nxt_http_request_pass(nxt_task_t *task, void *obj, void *data) } -nxt_http_pass_t * -nxt_http_request_application(nxt_task_t *task, nxt_http_request_t *r, - nxt_http_pass_t *pass) +nxt_http_action_t * +nxt_http_application_handler(nxt_task_t *task, nxt_http_request_t *r, + nxt_http_action_t *action) { nxt_event_engine_t *engine; - nxt_debug(task, "http request application"); + nxt_debug(task, "http application handler"); nxt_mp_retain(r->mem_pool); @@ -344,7 +344,7 @@ nxt_http_request_application(nxt_task_t *task, nxt_http_request_t *r, nxt_str_set(&r->server_name, "localhost"); } - nxt_router_process_http_request(task, r, pass->u.application); + nxt_router_process_http_request(task, r, action->u.application); return NULL; } -- cgit From d4e3951c4de0d17db943ea4a6ee1c9f570979358 Mon Sep 17 00:00:00 2001 From: Igor Sysoev Date: Thu, 14 Nov 2019 16:39:48 +0300 Subject: Using request task. --- src/nxt_http_request.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/nxt_http_request.c') diff --git a/src/nxt_http_request.c b/src/nxt_http_request.c index 1f7a1796..394411a9 100644 --- a/src/nxt_http_request.c +++ b/src/nxt_http_request.c @@ -570,9 +570,9 @@ nxt_http_request_close_handler(nxt_task_t *task, void *obj, void *data) if (nxt_fast_path(proto.any != NULL)) { protocol = r->protocol; - nxt_mp_release(r->mem_pool); - nxt_http_proto[protocol].close(task, proto, conf); + + nxt_mp_release(r->mem_pool); } } -- cgit From 57e326b4119863f737d8677adc69dc53c7e4ed27 Mon Sep 17 00:00:00 2001 From: Igor Sysoev Date: Thu, 14 Nov 2019 16:39:48 +0300 Subject: Introduced chained buffer completion handlers. --- src/nxt_http_request.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/nxt_http_request.c') diff --git a/src/nxt_http_request.c b/src/nxt_http_request.c index 394411a9..d40393b7 100644 --- a/src/nxt_http_request.c +++ b/src/nxt_http_request.c @@ -483,15 +483,20 @@ nxt_http_buf_mem(nxt_task_t *task, nxt_http_request_t *r, size_t size) static void nxt_http_request_mem_buf_completion(nxt_task_t *task, void *obj, void *data) { - nxt_buf_t *b; + nxt_buf_t *b, *next; nxt_http_request_t *r; b = obj; r = data; - nxt_mp_free(r->mem_pool, b); + do { + next = b->next; - nxt_mp_release(r->mem_pool); + nxt_mp_free(r->mem_pool, b); + nxt_mp_release(r->mem_pool); + + b = next; + } while (b != NULL); } -- cgit From ddde9c23cf302309d85ccc24b35075ce94da89a0 Mon Sep 17 00:00:00 2001 From: Igor Sysoev Date: Thu, 14 Nov 2019 16:39:54 +0300 Subject: Initial proxy support. --- src/nxt_http_request.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/nxt_http_request.c') diff --git a/src/nxt_http_request.c b/src/nxt_http_request.c index d40393b7..14c75dab 100644 --- a/src/nxt_http_request.c +++ b/src/nxt_http_request.c @@ -370,7 +370,7 @@ 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) + nxt_work_handler_t body_handler, void *data) { u_char *p, *end; nxt_http_field_t *server, *date, *content_length; @@ -431,7 +431,7 @@ nxt_http_request_header_send(nxt_task_t *task, nxt_http_request_t *r, } if (nxt_fast_path(r->proto.any != NULL)) { - nxt_http_proto[r->protocol].header_send(task, r, body_handler); + nxt_http_proto[r->protocol].header_send(task, r, body_handler, data); } return; -- cgit