diff options
author | Alexander Borisov <alexander.borisov@nginx.com> | 2019-03-06 15:26:45 +0300 |
---|---|---|
committer | Alexander Borisov <alexander.borisov@nginx.com> | 2019-03-06 15:26:45 +0300 |
commit | dccb4cf3548724fbec993c5bb83edf928d0b23bf (patch) | |
tree | c0484c59ccd8e868ae1373351def5edb28c28874 /src/nxt_http_request.c | |
parent | e1c4568680b63c478e8a0e111d8ad9316a96c442 (diff) | |
download | unit-dccb4cf3548724fbec993c5bb83edf928d0b23bf.tar.gz unit-dccb4cf3548724fbec993c5bb83edf928d0b23bf.tar.bz2 |
Removed unnecessary abstraction layer.
Diffstat (limited to '')
-rw-r--r-- | src/nxt_http_request.c | 82 |
1 files changed, 8 insertions, 74 deletions
diff --git a/src/nxt_http_request.c b/src/nxt_http_request.c index 724b0808..3c763dd0 100644 --- a/src/nxt_http_request.c +++ b/src/nxt_http_request.c @@ -322,31 +322,17 @@ nxt_http_pass_t * nxt_http_request_application(nxt_task_t *task, nxt_http_request_t *r, nxt_http_pass_t *pass) { - nxt_int_t ret; - nxt_event_engine_t *engine; - nxt_app_parse_ctx_t *ar; + nxt_event_engine_t *engine; nxt_debug(task, "http request application"); - ar = nxt_mp_zget(r->mem_pool, sizeof(nxt_app_parse_ctx_t)); - if (nxt_slow_path(ar == NULL)) { - nxt_http_request_error(task, r, NXT_HTTP_INTERNAL_SERVER_ERROR); - return NULL; - } - - ar->request = r; - ar->mem_pool = r->mem_pool; nxt_mp_retain(r->mem_pool); - // STUB engine = task->thread->engine; - ar->timer.task = &engine->task; - ar->timer.work_queue = &engine->fast_work_queue; - ar->timer.log = engine->task.log; - ar->timer.bias = NXT_TIMER_DEFAULT_BIAS; - - ar->r.remote.start = nxt_sockaddr_address(r->remote); - ar->r.remote.length = r->remote->address_length; + r->timer.task = &engine->task; + r->timer.work_queue = &engine->fast_work_queue; + r->timer.log = engine->task.log; + r->timer.bias = NXT_TIMER_DEFAULT_BIAS; /* * TODO: need an application flag to get local address @@ -354,66 +340,14 @@ nxt_http_request_application(nxt_task_t *task, nxt_http_request_t *r, */ nxt_http_request_local_addr(task, r); - if (nxt_fast_path(r->local != NULL)) { - ar->r.local.start = nxt_sockaddr_address(r->local); - ar->r.local.length = r->local->address_length; - } - - ar->r.header.fields = r->fields; - ar->r.header.done = 1; - ar->r.header.version = r->version; - - if (r->method != NULL) { - ar->r.header.method = *r->method; - } - if (r->host.length != 0) { - ar->r.header.server_name = r->host; + r->server_name = r->host; } else { - nxt_str_set(&ar->r.header.server_name, "localhost"); - } - - ar->r.header.target = r->target; - - if (r->path != NULL) { - ar->r.header.path = *r->path; - } - - if (r->args != NULL) { - ar->r.header.query = *r->args; - } - - if (r->content_type != NULL) { - ar->r.header.content_type.length = r->content_type->value_length; - ar->r.header.content_type.start = r->content_type->value; - } - - if (r->content_length != NULL) { - ar->r.header.content_length.length = r->content_length->value_length; - ar->r.header.content_length.start = r->content_length->value; - } - - if (r->cookie != NULL) { - ar->r.header.cookie.length = r->cookie->value_length; - ar->r.header.cookie.start = r->cookie->value; - } - - if (r->body != NULL) { - ar->r.body.buf = r->body; - ar->r.body.preread_size = r->content_length_n; - ar->r.header.parsed_content_length = r->content_length_n; - } - - ar->r.body.done = 1; - - ret = nxt_http_parse_request_init(&ar->resp_parser, r->mem_pool); - if (nxt_slow_path(ret != NXT_OK)) { - nxt_http_request_error(task, r, NXT_HTTP_INTERNAL_SERVER_ERROR); - return NULL; + nxt_str_set(&r->server_name, "localhost"); } - nxt_router_process_http_request(task, ar, pass->u.application); + nxt_router_process_http_request(task, r, pass->u.application); return NULL; } |