comparison src/http/ngx_http_request.c @ 550:1dcf6adad484 NGINX_0_8_21

nginx 0.8.21 *) Feature: now the "-V" switch shows TLS SNI support. *) Feature: the "listen" directive of the HTTP module supports unix domain sockets. Thanks to Hongli Lai. *) Feature: the "default_server" parameter of the "listen" directive. *) Feature: now a "default" parameter is not required to set listen socket options. *) Bugfix: nginx did not support dates in 2038 year on 32-bit platforms; *) Bugfix: socket leak; the bug had appeared in 0.8.11.
author Igor Sysoev <http://sysoev.ru>
date Mon, 26 Oct 2009 00:00:00 +0300
parents f7ec98e3caeb
children c04fa65fe604
comparison
equal deleted inserted replaced
549:3ca2e495d9de 550:1dcf6adad484
379 } 379 }
380 380
381 r->virtual_names = addr_conf->virtual_names; 381 r->virtual_names = addr_conf->virtual_names;
382 382
383 /* the default server configuration for the address:port */ 383 /* the default server configuration for the address:port */
384 cscf = addr_conf->core_srv_conf; 384 cscf = addr_conf->default_server;
385 385
386 r->main_conf = cscf->ctx->main_conf; 386 r->main_conf = cscf->ctx->main_conf;
387 r->srv_conf = cscf->ctx->srv_conf; 387 r->srv_conf = cscf->ctx->srv_conf;
388 r->loc_conf = cscf->ctx->loc_conf; 388 r->loc_conf = cscf->ctx->loc_conf;
389 389
1686 goto found; 1686 goto found;
1687 } 1687 }
1688 1688
1689 #if (NGX_PCRE) 1689 #if (NGX_PCRE)
1690 1690
1691 if (r->virtual_names->nregex) { 1691 if (len && r->virtual_names->nregex) {
1692 size_t ncaptures; 1692 size_t ncaptures;
1693 ngx_int_t n; 1693 ngx_int_t n;
1694 ngx_uint_t i; 1694 ngx_uint_t i;
1695 ngx_str_t name; 1695 ngx_str_t name;
1696 ngx_http_server_name_t *sn; 1696 ngx_http_server_name_t *sn;
1702 1702
1703 sn = r->virtual_names->regex; 1703 sn = r->virtual_names->regex;
1704 1704
1705 for (i = 0; i < r->virtual_names->nregex; i++) { 1705 for (i = 0; i < r->virtual_names->nregex; i++) {
1706 1706
1707 if (sn[i].captures && r->captures == NULL) { 1707 if (sn[i].server->captures && r->captures == NULL) {
1708 1708
1709 ncaptures = (NGX_HTTP_MAX_CAPTURES + 1) * 3; 1709 ncaptures = (NGX_HTTP_MAX_CAPTURES + 1) * 3;
1710 1710
1711 r->captures = ngx_palloc(r->pool, ncaptures * sizeof(int)); 1711 r->captures = ngx_palloc(r->pool, ncaptures * sizeof(int));
1712 if (r->captures == NULL) { 1712 if (r->captures == NULL) {
1728 return NGX_ERROR; 1728 return NGX_ERROR;
1729 } 1729 }
1730 1730
1731 /* match */ 1731 /* match */
1732 1732
1733 cscf = sn[i].core_srv_conf; 1733 cscf = sn[i].server;
1734 1734
1735 r->ncaptures = ncaptures; 1735 r->ncaptures = ncaptures;
1736 r->captures_data = host; 1736 r->captures_data = host;
1737 1737
1738 goto found; 1738 goto found;
2099 static void 2099 static void
2100 ngx_http_finalize_connection(ngx_http_request_t *r) 2100 ngx_http_finalize_connection(ngx_http_request_t *r)
2101 { 2101 {
2102 ngx_http_core_loc_conf_t *clcf; 2102 ngx_http_core_loc_conf_t *clcf;
2103 2103
2104 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
2105
2104 if (r->main->count != 1) { 2106 if (r->main->count != 1) {
2107
2108 if (r->discard_body) {
2109 r->read_event_handler = ngx_http_discarded_request_body_handler;
2110
2111 if (r->lingering_time == 0) {
2112 r->lingering_time = ngx_time()
2113 + (time_t) (clcf->lingering_time / 1000);
2114 ngx_add_timer(r->connection->read, clcf->lingering_timeout);
2115 }
2116 }
2117
2105 ngx_http_close_request(r, 0); 2118 ngx_http_close_request(r, 0);
2106 return; 2119 return;
2107 } 2120 }
2108
2109 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
2110 2121
2111 if (!ngx_terminate 2122 if (!ngx_terminate
2112 && !ngx_exiting 2123 && !ngx_exiting
2113 && r->keepalive 2124 && r->keepalive
2114 && clcf->keepalive_timeout > 0) 2125 && clcf->keepalive_timeout > 0)
2131 ngx_event_t *wev; 2142 ngx_event_t *wev;
2132 ngx_http_core_loc_conf_t *clcf; 2143 ngx_http_core_loc_conf_t *clcf;
2133 2144
2134 r->http_state = NGX_HTTP_WRITING_REQUEST_STATE; 2145 r->http_state = NGX_HTTP_WRITING_REQUEST_STATE;
2135 2146
2136 r->read_event_handler = ngx_http_test_reading; 2147 r->read_event_handler = r->discard_body ?
2148 ngx_http_discarded_request_body_handler:
2149 ngx_http_test_reading;
2137 r->write_event_handler = ngx_http_writer; 2150 r->write_event_handler = ngx_http_writer;
2138 2151
2139 wev = r->connection->write; 2152 wev = r->connection->write;
2140 2153
2141 if (wev->ready && wev->delayed) { 2154 if (wev->ready && wev->delayed) {
2232 return; 2245 return;
2233 } 2246 }
2234 2247
2235 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, wev->log, 0, 2248 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, wev->log, 0,
2236 "http writer done: \"%V?%V\"", &r->uri, &r->args); 2249 "http writer done: \"%V?%V\"", &r->uri, &r->args);
2250
2251 r->write_event_handler = ngx_http_request_empty_handler;
2237 2252
2238 ngx_http_finalize_request(r, rc); 2253 ngx_http_finalize_request(r, rc);
2239 } 2254 }
2240 2255
2241 2256