comparison src/http/ngx_http_upstream.c @ 8889:61d0fa67b55e quic

Merged with the default branch.
author Sergey Kandaurov <pluknet@nginx.com>
date Wed, 03 Nov 2021 11:22:07 +0300
parents fac88e160653 862f6130d357
children 33226ac61076
comparison
equal deleted inserted replaced
8888:6d1488b62dc5 8889:61d0fa67b55e
1529 1529
1530 1530
1531 static void 1531 static void
1532 ngx_http_upstream_connect(ngx_http_request_t *r, ngx_http_upstream_t *u) 1532 ngx_http_upstream_connect(ngx_http_request_t *r, ngx_http_upstream_t *u)
1533 { 1533 {
1534 ngx_int_t rc; 1534 ngx_int_t rc;
1535 ngx_connection_t *c; 1535 ngx_connection_t *c;
1536 ngx_http_core_loc_conf_t *clcf;
1536 1537
1537 r->connection->log->action = "connecting to upstream"; 1538 r->connection->log->action = "connecting to upstream";
1538 1539
1539 if (u->state && u->state->response_time == (ngx_msec_t) -1) { 1540 if (u->state && u->state->response_time == (ngx_msec_t) -1) {
1540 u->state->response_time = ngx_current_msec - u->start_time; 1541 u->state->response_time = ngx_current_msec - u->start_time;
1617 c->read->log = c->log; 1618 c->read->log = c->log;
1618 c->write->log = c->log; 1619 c->write->log = c->log;
1619 1620
1620 /* init or reinit the ngx_output_chain() and ngx_chain_writer() contexts */ 1621 /* init or reinit the ngx_output_chain() and ngx_chain_writer() contexts */
1621 1622
1623 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
1624
1622 u->writer.out = NULL; 1625 u->writer.out = NULL;
1623 u->writer.last = &u->writer.out; 1626 u->writer.last = &u->writer.out;
1624 u->writer.connection = c; 1627 u->writer.connection = c;
1625 u->writer.limit = 0; 1628 u->writer.limit = clcf->sendfile_max_chunk;
1626 1629
1627 if (u->request_sent) { 1630 if (u->request_sent) {
1628 if (ngx_http_upstream_reinit(r, u) != NGX_OK) { 1631 if (ngx_http_upstream_reinit(r, u) != NGX_OK) {
1629 ngx_http_upstream_finalize_request(r, u, 1632 ngx_http_upstream_finalize_request(r, u,
1630 NGX_HTTP_INTERNAL_SERVER_ERROR); 1633 NGX_HTTP_INTERNAL_SERVER_ERROR);
1701 ngx_http_upstream_finalize_request(r, u, 1704 ngx_http_upstream_finalize_request(r, u,
1702 NGX_HTTP_INTERNAL_SERVER_ERROR); 1705 NGX_HTTP_INTERNAL_SERVER_ERROR);
1703 return; 1706 return;
1704 } 1707 }
1705 1708
1706 c->sendfile = 0;
1707 u->output.sendfile = 0;
1708
1709 if (u->conf->ssl_server_name || u->conf->ssl_verify) { 1709 if (u->conf->ssl_server_name || u->conf->ssl_verify) {
1710 if (ngx_http_upstream_ssl_name(r, u, c) != NGX_OK) { 1710 if (ngx_http_upstream_ssl_name(r, u, c) != NGX_OK) {
1711 ngx_http_upstream_finalize_request(r, u, 1711 ngx_http_upstream_finalize_request(r, u,
1712 NGX_HTTP_INTERNAL_SERVER_ERROR); 1712 NGX_HTTP_INTERNAL_SERVER_ERROR);
1713 return; 1713 return;
1807 ngx_log_error(NGX_LOG_ERR, c->log, 0, 1807 ngx_log_error(NGX_LOG_ERR, c->log, 0,
1808 "upstream SSL certificate does not match \"%V\"", 1808 "upstream SSL certificate does not match \"%V\"",
1809 &u->ssl_name); 1809 &u->ssl_name);
1810 goto failed; 1810 goto failed;
1811 } 1811 }
1812 }
1813
1814 if (!c->ssl->sendfile) {
1815 c->sendfile = 0;
1816 u->output.sendfile = 0;
1812 } 1817 }
1813 1818
1814 c->write->handler = ngx_http_upstream_handler; 1819 c->write->handler = ngx_http_upstream_handler;
1815 c->read->handler = ngx_http_upstream_handler; 1820 c->read->handler = ngx_http_upstream_handler;
1816 1821