Lines Matching refs:r

31     nxt_http_request_t *r);
44 static void nxt_h1p_request_body_read(nxt_task_t *task, nxt_http_request_t *r);
47 static void nxt_h1p_request_local_addr(nxt_task_t *task, nxt_http_request_t *r);
49 nxt_http_request_t *r, nxt_work_handler_t body_handler, void *data);
50 static void nxt_h1p_request_send(nxt_task_t *task, nxt_http_request_t *r,
52 static nxt_buf_t *nxt_h1p_chunk_create(nxt_task_t *task, nxt_http_request_t *r,
56 static void nxt_h1p_request_discard(nxt_task_t *task, nxt_http_request_t *r,
64 nxt_http_request_t *r);
473 nxt_http_request_t *r; in nxt_h1p_conn_request_init() local
483 r = nxt_http_request_create(task); in nxt_h1p_conn_request_init()
485 if (nxt_fast_path(r != NULL)) { in nxt_h1p_conn_request_init()
486 h1p->request = r; in nxt_h1p_conn_request_init()
487 r->proto.h1 = h1p; in nxt_h1p_conn_request_init()
490 r->remote = c->remote; in nxt_h1p_conn_request_init()
493 r->tls = (c->u.tls != NULL); in nxt_h1p_conn_request_init()
496 r->task = c->task; in nxt_h1p_conn_request_init()
497 task = &r->task; in nxt_h1p_conn_request_init()
502 ret = nxt_http_parse_request_init(&h1p->parser, r->mem_pool); in nxt_h1p_conn_request_init()
508 r->conf = joint; in nxt_h1p_conn_request_init()
525 nxt_mp_release(r->mem_pool); in nxt_h1p_conn_request_init()
552 nxt_http_request_t *r; in nxt_h1p_conn_request_header_parse() local
567 r = h1p->request; in nxt_h1p_conn_request_header_parse()
579 ret = nxt_h1p_header_process(task, h1p, r); in nxt_h1p_conn_request_header_parse()
584 if (c->u.tls == NULL && r->conf->socket_conf->tls != NULL) { in nxt_h1p_conn_request_header_parse()
590 r->state->ready_handler(task, r, NULL); in nxt_h1p_conn_request_header_parse()
598 status = nxt_h1p_header_buffer_test(task, h1p, c, r->conf->socket_conf); in nxt_h1p_conn_request_header_parse()
627 (void) nxt_h1p_header_process(task, h1p, r); in nxt_h1p_conn_request_header_parse()
633 nxt_http_request_error(task, r, status); in nxt_h1p_conn_request_header_parse()
639 nxt_http_request_t *r) in nxt_h1p_header_process() argument
644 r->target.start = h1p->parser.target_start; in nxt_h1p_header_process()
645 r->target.length = h1p->parser.target_end - h1p->parser.target_start; in nxt_h1p_header_process()
648 r->version.start = h1p->parser.version.str; in nxt_h1p_header_process()
649 r->version.length = sizeof(h1p->parser.version.str); in nxt_h1p_header_process()
652 r->method = &h1p->parser.method; in nxt_h1p_header_process()
653 r->path = &h1p->parser.path; in nxt_h1p_header_process()
654 r->args = &h1p->parser.args; in nxt_h1p_header_process()
656 r->fields = h1p->parser.fields; in nxt_h1p_header_process()
658 ret = nxt_http_fields_process(r->fields, &nxt_h1p_fields_hash, r); in nxt_h1p_header_process()
696 r->websocket_handshake = 1; in nxt_h1p_header_process()
741 nxt_http_request_t *r; in nxt_h1p_connection() local
743 r = ctx; in nxt_h1p_connection()
749 r->proto.h1->keepalive = 0; in nxt_h1p_connection()
754 r->proto.h1->keepalive = 1; in nxt_h1p_connection()
759 r->proto.h1->connection_upgrade = 1; in nxt_h1p_connection()
769 nxt_http_request_t *r; in nxt_h1p_upgrade() local
771 r = ctx; in nxt_h1p_upgrade()
776 r->proto.h1->upgrade_websocket = 1; in nxt_h1p_upgrade()
786 nxt_http_request_t *r; in nxt_h1p_websocket_key() local
788 r = ctx; in nxt_h1p_websocket_key()
791 r->proto.h1->websocket_key = field; in nxt_h1p_websocket_key()
801 nxt_http_request_t *r; in nxt_h1p_websocket_version() local
803 r = ctx; in nxt_h1p_websocket_version()
808 r->proto.h1->websocket_version_ok = 1; in nxt_h1p_websocket_version()
819 nxt_http_request_t *r; in nxt_h1p_transfer_encoding() local
821 r = ctx; in nxt_h1p_transfer_encoding()
834 r->proto.h1->transfer_encoding = te; in nxt_h1p_transfer_encoding()
841 nxt_h1p_request_body_read(nxt_task_t *task, nxt_http_request_t *r) in nxt_h1p_request_body_read() argument
853 h1p = r->proto.h1; in nxt_h1p_request_body_read()
856 r->content_length_n, h1p->transfer_encoding); in nxt_h1p_request_body_read()
873 if (r->content_length_n == -1 || r->content_length_n == 0) { in nxt_h1p_request_body_read()
877 body_length = (size_t) r->content_length_n; in nxt_h1p_request_body_read()
879 body_buffer_size = nxt_min(r->conf->socket_conf->body_buffer_size, in nxt_h1p_request_body_read()
883 tmp_path = &r->conf->socket_conf->body_temp_path; in nxt_h1p_request_body_read()
887 b = nxt_buf_file_alloc(r->mem_pool, in nxt_h1p_request_body_read()
896 b = nxt_buf_mem_alloc(r->mem_pool, body_buffer_size, 0); in nxt_h1p_request_body_read()
904 r->body = b; in nxt_h1p_request_body_read()
988 r->state->ready_handler(task, r, NULL); in nxt_h1p_request_body_read()
996 nxt_http_request_error(task, r, status); in nxt_h1p_request_body_read()
1022 nxt_http_request_t *r; in nxt_h1p_conn_request_body_read() local
1030 r = h1p->request; in nxt_h1p_conn_request_body_read()
1044 nxt_h1p_request_error(task, h1p, r); in nxt_h1p_conn_request_body_read()
1084 r->state->ready_handler(task, r, NULL); in nxt_h1p_conn_request_body_read()
1090 nxt_h1p_request_local_addr(nxt_task_t *task, nxt_http_request_t *r) in nxt_h1p_request_local_addr() argument
1092 r->local = nxt_conn_local_addr(task, r->proto.h1->conn); in nxt_h1p_request_local_addr()
1197 nxt_h1p_request_header_send(nxt_task_t *task, nxt_http_request_t *r, in nxt_h1p_request_header_send() argument
1226 r->header_sent = 1; in nxt_h1p_request_header_send()
1227 h1p = r->proto.h1; in nxt_h1p_request_header_send()
1228 n = r->status; in nxt_h1p_request_header_send()
1270 if (r->websocket_handshake && n == NXT_HTTP_SWITCHING_PROTOCOLS) { in nxt_h1p_request_header_send()
1279 if (r->resp.content_length == NULL || r->resp.content_length->skip) { in nxt_h1p_request_header_send()
1307 nxt_list_each(field, r->resp.fields) { in nxt_h1p_request_header_send()
1320 header = nxt_http_buf_mem(task, r, size); in nxt_h1p_request_header_send()
1322 nxt_h1p_request_error(task, h1p, r); in nxt_h1p_request_header_send()
1328 nxt_list_each(field, r->resp.fields) { in nxt_h1p_request_header_send()
1379 body_handler, task, r, data); in nxt_h1p_request_header_send()
1382 header->next = nxt_http_buf_last(r); in nxt_h1p_request_header_send()
1388 nxt_h1p_websocket_first_frame_start(task, r, c->read); in nxt_h1p_request_header_send()
1455 nxt_h1p_request_send(nxt_task_t *task, nxt_http_request_t *r, nxt_buf_t *out) in nxt_h1p_request_send() argument
1462 h1p = r->proto.h1; in nxt_h1p_request_send()
1466 out = nxt_h1p_chunk_create(task, r, out); in nxt_h1p_request_send()
1468 nxt_h1p_request_error(task, h1p, r); in nxt_h1p_request_send()
1492 nxt_h1p_chunk_create(nxt_task_t *task, nxt_http_request_t *r, nxt_buf_t *out) in nxt_h1p_chunk_create() argument
1506 tail = nxt_http_buf_mem(task, r, sizeof(tail_chunk)); in nxt_h1p_chunk_create()
1531 header = nxt_http_buf_mem(task, r, chunk_size); in nxt_h1p_chunk_create()
1558 nxt_h1p_request_discard(nxt_task_t *task, nxt_http_request_t *r, in nxt_h1p_request_discard() argument
1568 h1p = r->proto.h1; in nxt_h1p_request_discard()
1586 nxt_http_request_t *r; in nxt_h1p_conn_request_error() local
1592 r = h1p->request; in nxt_h1p_conn_request_error()
1594 if (nxt_slow_path(r == NULL)) { in nxt_h1p_conn_request_error()
1599 if (r->fields == NULL) { in nxt_h1p_conn_request_error()
1600 (void) nxt_h1p_header_process(task, h1p, r); in nxt_h1p_conn_request_error()
1603 if (r->status == 0) { in nxt_h1p_conn_request_error()
1604 r->status = NXT_HTTP_BAD_REQUEST; in nxt_h1p_conn_request_error()
1607 nxt_h1p_request_error(task, h1p, r); in nxt_h1p_conn_request_error()
1617 nxt_http_request_t *r; in nxt_h1p_conn_request_timeout() local
1633 r = h1p->request; in nxt_h1p_conn_request_timeout()
1635 if (r->fields == NULL) { in nxt_h1p_conn_request_timeout()
1636 (void) nxt_h1p_header_process(task, h1p, r); in nxt_h1p_conn_request_timeout()
1639 nxt_http_request_error(task, r, NXT_HTTP_REQUEST_TIMEOUT); in nxt_h1p_conn_request_timeout()
1675 nxt_http_request_t *r) in nxt_h1p_request_error() argument
1679 r->state->error_handler(task, r, h1p); in nxt_h1p_request_error()
2136 nxt_http_request_t *r; in nxt_h1p_peer_connect() local
2141 r = peer->request; in nxt_h1p_peer_connect()
2154 ret = nxt_http_parse_request_init(&h1p->parser, r->mem_pool); in nxt_h1p_peer_connect()
2168 h1p->request = r; in nxt_h1p_peer_connect()
2179 client = r->proto.h1->conn; in nxt_h1p_peer_connect()
2201 r->state->error_handler(task, r, peer); in nxt_h1p_peer_connect()
2222 nxt_http_request_t *r; in nxt_h1p_peer_connected() local
2228 r = peer->request; in nxt_h1p_peer_connected()
2229 r->state->ready_handler(task, r, peer); in nxt_h1p_peer_connected()
2237 nxt_http_request_t *r; in nxt_h1p_peer_refused() local
2246 r = peer->request; in nxt_h1p_peer_refused()
2247 r->state->error_handler(task, r, peer); in nxt_h1p_peer_refused()
2259 nxt_http_request_t *r; in nxt_h1p_peer_header_send() local
2263 r = peer->request; in nxt_h1p_peer_header_send()
2265 size = r->method->length + sizeof(" ") + r->target.length in nxt_h1p_peer_header_send()
2270 nxt_list_each(field, r->fields) { in nxt_h1p_peer_header_send()
2279 header = nxt_http_buf_mem(task, r, size); in nxt_h1p_peer_header_send()
2281 r->state->error_handler(task, r, peer); in nxt_h1p_peer_header_send()
2287 p = nxt_cpymem(p, r->method->start, r->method->length); in nxt_h1p_peer_header_send()
2289 p = nxt_cpymem(p, r->target.start, r->target.length); in nxt_h1p_peer_header_send()
2293 nxt_list_each(field, r->fields) { in nxt_h1p_peer_header_send()
2312 if (r->body != NULL) { in nxt_h1p_peer_header_send()
2313 if (nxt_buf_is_file(r->body)) { in nxt_h1p_peer_header_send()
2314 body = nxt_buf_file_alloc(r->mem_pool, 0, 0); in nxt_h1p_peer_header_send()
2317 body = nxt_buf_mem_alloc(r->mem_pool, 0, 0); in nxt_h1p_peer_header_send()
2321 r->state->error_handler(task, r, peer); in nxt_h1p_peer_header_send()
2327 if (nxt_buf_is_file(r->body)) { in nxt_h1p_peer_header_send()
2328 body->file = r->body->file; in nxt_h1p_peer_header_send()
2329 body->file_end = r->body->file_end; in nxt_h1p_peer_header_send()
2332 body->mem = r->body->mem; in nxt_h1p_peer_header_send()
2379 nxt_http_request_t *r; in nxt_h1p_peer_header_sent() local
2396 r = peer->request; in nxt_h1p_peer_header_sent()
2397 r->state->ready_handler(task, r, peer); in nxt_h1p_peer_header_sent()
2455 nxt_http_request_t *r; in nxt_h1p_peer_io_read_handler() local
2458 r = peer->request; in nxt_h1p_peer_io_read_handler()
2462 skcf = r->conf->socket_conf; in nxt_h1p_peer_io_read_handler()
2469 b = nxt_http_proxy_buf_mem_alloc(task, r, size); in nxt_h1p_peer_io_read_handler()
2483 nxt_http_proxy_buf_mem_free(task, r, b); in nxt_h1p_peer_io_read_handler()
2498 nxt_http_request_t *r; in nxt_h1p_peer_header_read_done() local
2510 r = peer->request; in nxt_h1p_peer_header_read_done()
2526 &nxt_h1p_peer_fields_hash, r); in nxt_h1p_peer_header_read_done()
2539 if (r->resp.content_length != NULL) { in nxt_h1p_peer_header_read_done()
2546 } else if (r->resp.content_length_n > 0) { in nxt_h1p_peer_header_read_done()
2547 h1p->remainder = r->resp.content_length_n; in nxt_h1p_peer_header_read_done()
2555 r->state->ready_handler(task, r, peer); in nxt_h1p_peer_header_read_done()
2575 nxt_http_proxy_buf_mem_free(task, r, b); in nxt_h1p_peer_header_read_done()
2577 r->state->error_handler(task, r, peer); in nxt_h1p_peer_header_read_done()
2681 nxt_http_request_t *r; in nxt_h1p_peer_body_process() local
2690 r = peer->request; in nxt_h1p_peer_body_process()
2691 r->state->error_handler(task, r, peer); in nxt_h1p_peer_body_process()
2707 r = peer->request; in nxt_h1p_peer_body_process()
2708 r->state->ready_handler(task, r, peer); in nxt_h1p_peer_body_process()
2716 nxt_http_request_t *r; in nxt_h1p_peer_closed() local
2722 r = peer->request; in nxt_h1p_peer_closed()
2725 peer->body = nxt_http_buf_last(r); in nxt_h1p_peer_closed()
2727 r->inconsistent = (peer->proto.h1->remainder != 0); in nxt_h1p_peer_closed()
2729 r->state->ready_handler(task, r, peer); in nxt_h1p_peer_closed()
2734 r->state->error_handler(task, r, peer); in nxt_h1p_peer_closed()
2743 nxt_http_request_t *r; in nxt_h1p_peer_error() local
2751 r = peer->request; in nxt_h1p_peer_error()
2752 r->state->error_handler(task, r, peer); in nxt_h1p_peer_error()
2762 nxt_http_request_t *r; in nxt_h1p_peer_send_timeout() local
2775 r = peer->request; in nxt_h1p_peer_send_timeout()
2776 r->state->error_handler(task, r, peer); in nxt_h1p_peer_send_timeout()
2786 nxt_http_request_t *r; in nxt_h1p_peer_read_timeout() local
2799 r = peer->request; in nxt_h1p_peer_read_timeout()
2800 r->state->error_handler(task, r, peer); in nxt_h1p_peer_read_timeout()
2865 nxt_http_request_t *r; in nxt_h1p_peer_transfer_encoding() local
2867 r = ctx; in nxt_h1p_peer_transfer_encoding()
2873 r->peer->proto.h1->chunked = 1; in nxt_h1p_peer_transfer_encoding()