Lines Matching refs:r

14     nxt_http_request_t *r, nxt_http_forward_t *forward);
15 static void nxt_http_request_forward_client_ip(nxt_http_request_t *r,
18 nxt_http_request_t *r, u_char *start, size_t len);
19 static void nxt_http_request_forward_protocol(nxt_http_request_t *r,
23 nxt_http_request_t *r);
85 nxt_http_request_t *r; in nxt_http_request_host() local
87 r = ctx; in nxt_http_request_host()
89 if (nxt_slow_path(r->host.start != NULL)) { in nxt_http_request_host()
96 ret = nxt_http_validate_host(&host, r->mem_pool); in nxt_http_request_host()
99 r->host = host; in nxt_http_request_host()
202 nxt_http_request_t *r; in nxt_http_request_field() local
204 r = ctx; in nxt_http_request_field()
206 nxt_value_at(nxt_http_field_t *, r, offset) = field; in nxt_http_request_field()
217 nxt_http_request_t *r; in nxt_http_request_content_length() local
219 r = ctx; in nxt_http_request_content_length()
221 if (nxt_fast_path(r->content_length == NULL)) { in nxt_http_request_content_length()
222 r->content_length = field; in nxt_http_request_content_length()
227 r->content_length_n = n; in nxt_http_request_content_length()
229 max_body_size = r->conf->socket_conf->max_body_size; in nxt_http_request_content_length()
248 nxt_http_request_t *r; in nxt_http_request_create() local
255 r = nxt_mp_zget(mp, sizeof(nxt_http_request_t)); in nxt_http_request_create()
256 if (nxt_slow_path(r == NULL)) { in nxt_http_request_create()
260 r->resp.fields = nxt_list_create(mp, 8, sizeof(nxt_http_field_t)); in nxt_http_request_create()
261 if (nxt_slow_path(r->resp.fields == NULL)) { in nxt_http_request_create()
273 last->parent = r; in nxt_http_request_create()
274 r->last = last; in nxt_http_request_create()
276 r->mem_pool = mp; in nxt_http_request_create()
277 r->content_length_n = -1; in nxt_http_request_create()
278 r->resp.content_length_n = -1; in nxt_http_request_create()
279 r->state = &nxt_http_request_init_state; in nxt_http_request_create()
281 r->start_time = nxt_thread_monotonic_time(task->thread); in nxt_http_request_create()
285 r->tstr_cache.var.pool = mp; in nxt_http_request_create()
287 return r; in nxt_http_request_create()
310 nxt_http_request_t *r; in nxt_http_request_start() local
312 r = obj; in nxt_http_request_start()
314 r->state = &nxt_http_request_body_state; in nxt_http_request_start()
316 skcf = r->conf->socket_conf; in nxt_http_request_start()
319 ret = nxt_http_request_forward(task, r, skcf->forwarded); in nxt_http_request_start()
326 ret = nxt_http_request_forward(task, r, skcf->client_ip); in nxt_http_request_start()
332 nxt_http_request_read_body(task, r); in nxt_http_request_start()
337 nxt_http_request_error(task, r, NXT_HTTP_INTERNAL_SERVER_ERROR); in nxt_http_request_start()
342 nxt_http_request_forward(nxt_task_t *task, nxt_http_request_t *r, in nxt_http_request_forward() argument
350 ret = nxt_http_route_addr_rule(r, forward->source, r->remote); in nxt_http_request_forward()
359 client_ip_fields = nxt_array_create(r->mem_pool, 1, in nxt_http_request_forward()
371 nxt_list_each(f, r->fields) { in nxt_http_request_forward()
400 nxt_http_request_forward_client_ip(r, forward, client_ip_fields); in nxt_http_request_forward()
404 nxt_http_request_forward_protocol(r, protocol_field); in nxt_http_request_forward()
412 nxt_http_request_forward_client_ip(nxt_http_request_t *r, in nxt_http_request_forward_client_ip() argument
420 prev_sa = r->remote; in nxt_http_request_forward_client_ip()
443 sa = nxt_http_request_client_ip_sockaddr(r, p, len - (p - start)); in nxt_http_request_forward_client_ip()
446 r->remote = prev_sa; in nxt_http_request_forward_client_ip()
453 r->remote = sa; in nxt_http_request_forward_client_ip()
457 ret = nxt_http_route_addr_rule(r, forward->source, sa); in nxt_http_request_forward_client_ip()
459 r->remote = sa; in nxt_http_request_forward_client_ip()
472 nxt_http_request_client_ip_sockaddr(nxt_http_request_t *r, u_char *start, in nxt_http_request_client_ip_sockaddr() argument
481 sa = nxt_sockaddr_parse_optport(r->mem_pool, &addr); in nxt_http_request_client_ip_sockaddr()
512 nxt_http_request_forward_protocol(nxt_http_request_t *r, in nxt_http_request_forward_protocol() argument
517 r->tls = 0; in nxt_http_request_forward_protocol()
522 r->tls = 1; in nxt_http_request_forward_protocol()
527 r->tls = 1; in nxt_http_request_forward_protocol()
545 nxt_http_request_t *r; in nxt_http_request_ready() local
547 r = obj; in nxt_http_request_ready()
548 action = r->conf->socket_conf->action; in nxt_http_request_ready()
550 nxt_http_request_action(task, r, action); in nxt_http_request_ready()
555 nxt_http_request_action(nxt_task_t *task, nxt_http_request_t *r, in nxt_http_request_action() argument
561 action = action->handler(task, r, action); in nxt_http_request_action()
571 } while (r->pass_count++ < 255); in nxt_http_request_action()
574 nxt_http_request_error(task, r, NXT_HTTP_INTERNAL_SERVER_ERROR); in nxt_http_request_action()
579 nxt_http_application_handler(nxt_task_t *task, nxt_http_request_t *r, in nxt_http_application_handler() argument
588 nxt_http_request_proto_info(task, r); in nxt_http_application_handler()
590 if (r->host.length != 0) { in nxt_http_application_handler()
591 r->server_name = r->host; in nxt_http_application_handler()
594 nxt_str_set(&r->server_name, "localhost"); in nxt_http_application_handler()
597 nxt_router_process_http_request(task, r, action); in nxt_http_application_handler()
604 nxt_http_request_proto_info(nxt_task_t *task, nxt_http_request_t *r) in nxt_http_request_proto_info() argument
606 if (nxt_fast_path(r->proto.any != NULL)) { in nxt_http_request_proto_info()
607 nxt_http_proto[r->protocol].local_addr(task, r); in nxt_http_request_proto_info()
613 nxt_http_request_read_body(nxt_task_t *task, nxt_http_request_t *r) in nxt_http_request_read_body() argument
615 if (nxt_fast_path(r->proto.any != NULL)) { in nxt_http_request_read_body()
616 nxt_http_proto[r->protocol].body_read(task, r); in nxt_http_request_read_body()
622 nxt_http_request_header_send(nxt_task_t *task, nxt_http_request_t *r, in nxt_http_request_header_send() argument
633 server = nxt_list_zero_add(r->resp.fields); in nxt_http_request_header_send()
640 if (r->resp.date == NULL) { in nxt_http_request_header_send()
641 date = nxt_list_zero_add(r->resp.fields); in nxt_http_request_header_send()
648 p = nxt_mp_nget(r->mem_pool, nxt_http_date_cache.size); in nxt_http_request_header_send()
658 r->resp.date = date; in nxt_http_request_header_send()
661 if (r->resp.content_length_n != -1 in nxt_http_request_header_send()
662 && (r->resp.content_length == NULL || r->resp.content_length->skip)) in nxt_http_request_header_send()
664 content_length = nxt_list_zero_add(r->resp.fields); in nxt_http_request_header_send()
671 p = nxt_mp_nget(r->mem_pool, NXT_OFF_T_LEN); in nxt_http_request_header_send()
677 end = nxt_sprintf(p, p + NXT_OFF_T_LEN, "%O", r->resp.content_length_n); in nxt_http_request_header_send()
680 r->resp.content_length = content_length; in nxt_http_request_header_send()
683 if (nxt_fast_path(r->proto.any != NULL)) { in nxt_http_request_header_send()
684 nxt_http_proto[r->protocol].header_send(task, r, body_handler, data); in nxt_http_request_header_send()
691 nxt_http_request_error(task, r, NXT_HTTP_INTERNAL_SERVER_ERROR); in nxt_http_request_header_send()
696 nxt_http_request_ws_frame_start(nxt_task_t *task, nxt_http_request_t *r, in nxt_http_request_ws_frame_start() argument
699 if (r->proto.any != NULL) { in nxt_http_request_ws_frame_start()
700 nxt_http_proto[r->protocol].ws_frame_start(task, r, ws_frame); in nxt_http_request_ws_frame_start()
706 nxt_http_request_send(nxt_task_t *task, nxt_http_request_t *r, nxt_buf_t *out) in nxt_http_request_send() argument
708 if (nxt_fast_path(r->proto.any != NULL)) { in nxt_http_request_send()
709 nxt_http_proto[r->protocol].send(task, r, out); in nxt_http_request_send()
715 nxt_http_buf_mem(nxt_task_t *task, nxt_http_request_t *r, size_t size) in nxt_http_buf_mem() argument
719 b = nxt_buf_mem_alloc(r->mem_pool, size, 0); in nxt_http_buf_mem()
722 b->parent = r; in nxt_http_buf_mem()
723 nxt_mp_retain(r->mem_pool); in nxt_http_buf_mem()
726 nxt_http_request_error(task, r, NXT_HTTP_INTERNAL_SERVER_ERROR); in nxt_http_buf_mem()
737 nxt_http_request_t *r; in nxt_http_request_mem_buf_completion() local
740 r = data; in nxt_http_request_mem_buf_completion()
745 nxt_mp_free(r->mem_pool, b); in nxt_http_request_mem_buf_completion()
746 nxt_mp_release(r->mem_pool); in nxt_http_request_mem_buf_completion()
754 nxt_http_buf_last(nxt_http_request_t *r) in nxt_http_buf_last() argument
758 last = r->last; in nxt_http_buf_last()
759 r->last = NULL; in nxt_http_buf_last()
768 nxt_http_request_t *r; in nxt_http_request_done() local
770 r = data; in nxt_http_request_done()
774 nxt_http_request_close_handler(task, r, r->proto.any); in nxt_http_request_done()
782 nxt_http_request_t *r; in nxt_http_request_error_handler() local
784 r = obj; in nxt_http_request_error_handler()
789 r->error = 1; in nxt_http_request_error_handler()
792 nxt_http_proto[r->protocol].discard(task, r, nxt_http_buf_last(r)); in nxt_http_request_error_handler()
802 nxt_http_request_t *r; in nxt_http_request_close_handler() local
807 r = obj; in nxt_http_request_close_handler()
810 conf = r->conf; in nxt_http_request_close_handler()
812 if (!r->logged) { in nxt_http_request_close_handler()
813 r->logged = 1; in nxt_http_request_close_handler()
819 access_log->handler(task, r, access_log, log_format); in nxt_http_request_close_handler()
826 r->proto.any = NULL; in nxt_http_request_close_handler()
828 if (r->body != NULL && nxt_buf_is_file(r->body) in nxt_http_request_close_handler()
829 && r->body->file->fd != -1) in nxt_http_request_close_handler()
831 nxt_fd_close(r->body->file->fd); in nxt_http_request_close_handler()
833 r->body->file->fd = -1; in nxt_http_request_close_handler()
837 protocol = r->protocol; in nxt_http_request_close_handler()
841 nxt_mp_release(r->mem_pool); in nxt_http_request_close_handler()
855 nxt_http_arguments_parse(nxt_http_request_t *r) in nxt_http_arguments_parse() argument
864 if (r->arguments != NULL) { in nxt_http_arguments_parse()
865 return r->arguments; in nxt_http_arguments_parse()
868 args = nxt_array_create(r->mem_pool, 2, sizeof(nxt_http_name_value_t)); in nxt_http_arguments_parse()
877 dst_start = nxt_mp_nget(r->mem_pool, r->args->length); in nxt_http_arguments_parse()
882 r->args_decoded.start = dst_start; in nxt_http_arguments_parse()
884 start = r->args->start; in nxt_http_arguments_parse()
885 end = start + r->args->length; in nxt_http_arguments_parse()
944 r->args_decoded.length = dst - r->args_decoded.start; in nxt_http_arguments_parse()
953 r->arguments = args; in nxt_http_arguments_parse()
991 nxt_http_cookies_parse(nxt_http_request_t *r) in nxt_http_cookies_parse() argument
997 if (r->cookies != NULL) { in nxt_http_cookies_parse()
998 return r->cookies; in nxt_http_cookies_parse()
1001 cookies = nxt_array_create(r->mem_pool, 2, sizeof(nxt_http_name_value_t)); in nxt_http_cookies_parse()
1006 nxt_list_each(f, r->fields) { in nxt_http_cookies_parse()
1023 r->cookies = cookies; in nxt_http_cookies_parse()