Mercurial > hg > nginx-vendor-0-8
comparison src/http/ngx_http_request.c @ 454:a8424ffa495c NGINX_0_7_39
nginx 0.7.39
*) Bugfix: large response with SSI might hang, if gzipping was enabled;
the bug had appeared in 0.7.28.
Thanks to Artem Bokhan.
*) Bugfix: a segmentation fault might occur in worker process, if short
static variants are used in a "try_files" directive.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Mon, 02 Mar 2009 00:00:00 +0300 |
parents | 76a79816b771 |
children | ca8f7f6cab16 |
comparison
equal
deleted
inserted
replaced
453:9ef0e36f3cd5 | 454:a8424ffa495c |
---|---|
298 | 298 |
299 /* find the server configuration for the address:port */ | 299 /* find the server configuration for the address:port */ |
300 | 300 |
301 port = c->listening->servers; | 301 port = c->listening->servers; |
302 | 302 |
303 r->port = port->port; | |
304 r->port_text = &port->port_text; | |
305 | |
306 r->connection = c; | 303 r->connection = c; |
307 | 304 |
308 if (port->naddrs > 1) { | 305 if (port->naddrs > 1) { |
309 | 306 |
310 /* | 307 /* |
371 #endif | 368 #endif |
372 | 369 |
373 default: /* AF_INET */ | 370 default: /* AF_INET */ |
374 addr = port->addrs; | 371 addr = port->addrs; |
375 addr_conf = &addr[0].conf; | 372 addr_conf = &addr[0].conf; |
376 r->in_addr = addr[0].addr; | |
377 break; | 373 break; |
378 } | 374 } |
379 } | 375 } |
380 | |
381 r->virtual_names = addr_conf->virtual_names; | |
382 | 376 |
383 /* the default server configuration for the address:port */ | 377 /* the default server configuration for the address:port */ |
384 cscf = addr_conf->core_srv_conf; | 378 cscf = addr_conf->core_srv_conf; |
385 | 379 |
386 r->main_conf = cscf->ctx->main_conf; | 380 r->main_conf = cscf->ctx->main_conf; |
408 ngx_http_close_connection(c); | 402 ngx_http_close_connection(c); |
409 return; | 403 return; |
410 } | 404 } |
411 | 405 |
412 if (ngx_ssl_create_connection(&sscf->ssl, c, NGX_SSL_BUFFER) | 406 if (ngx_ssl_create_connection(&sscf->ssl, c, NGX_SSL_BUFFER) |
413 == NGX_ERROR) | 407 != NGX_OK) |
414 { | 408 { |
415 ngx_http_close_connection(c); | 409 ngx_http_close_connection(c); |
416 return; | 410 return; |
417 } | 411 } |
418 | 412 |
451 } | 445 } |
452 | 446 |
453 | 447 |
454 if (ngx_list_init(&r->headers_out.headers, r->pool, 20, | 448 if (ngx_list_init(&r->headers_out.headers, r->pool, 20, |
455 sizeof(ngx_table_elt_t)) | 449 sizeof(ngx_table_elt_t)) |
456 == NGX_ERROR) | 450 != NGX_OK) |
457 { | 451 { |
458 ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); | 452 ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); |
459 return; | 453 return; |
460 } | 454 } |
461 | 455 |
811 } | 805 } |
812 | 806 |
813 | 807 |
814 if (ngx_list_init(&r->headers_in.headers, r->pool, 20, | 808 if (ngx_list_init(&r->headers_in.headers, r->pool, 20, |
815 sizeof(ngx_table_elt_t)) | 809 sizeof(ngx_table_elt_t)) |
816 == NGX_ERROR) | 810 != NGX_OK) |
817 { | 811 { |
818 ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); | 812 ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); |
819 return; | 813 return; |
820 } | 814 } |
821 | 815 |
822 | 816 |
823 if (ngx_array_init(&r->headers_in.cookies, r->pool, 2, | 817 if (ngx_array_init(&r->headers_in.cookies, r->pool, 2, |
824 sizeof(ngx_table_elt_t *)) | 818 sizeof(ngx_table_elt_t *)) |
825 == NGX_ERROR) | 819 != NGX_OK) |
826 { | 820 { |
827 ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); | 821 ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); |
828 return; | 822 return; |
829 } | 823 } |
830 | 824 |
1616 static ngx_int_t | 1610 static ngx_int_t |
1617 ngx_http_find_virtual_server(ngx_http_request_t *r, u_char *host, size_t len) | 1611 ngx_http_find_virtual_server(ngx_http_request_t *r, u_char *host, size_t len) |
1618 { | 1612 { |
1619 u_char *server; | 1613 u_char *server; |
1620 ngx_uint_t hash; | 1614 ngx_uint_t hash; |
1615 ngx_http_virtual_names_t *vn; | |
1621 ngx_http_core_loc_conf_t *clcf; | 1616 ngx_http_core_loc_conf_t *clcf; |
1622 ngx_http_core_srv_conf_t *cscf; | 1617 ngx_http_core_srv_conf_t *cscf; |
1623 u_char buf[32]; | 1618 u_char buf[32]; |
1624 | 1619 |
1625 if (r->virtual_names == NULL) { | 1620 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module); |
1621 vn = cscf->virtual_names; | |
1622 | |
1623 if (vn == NULL) { | |
1626 return NGX_DECLINED; | 1624 return NGX_DECLINED; |
1627 } | 1625 } |
1628 | 1626 |
1629 if (len <= 32) { | 1627 if (len <= 32) { |
1630 server = buf; | 1628 server = buf; |
1636 } | 1634 } |
1637 } | 1635 } |
1638 | 1636 |
1639 hash = ngx_hash_strlow(server, host, len); | 1637 hash = ngx_hash_strlow(server, host, len); |
1640 | 1638 |
1641 cscf = ngx_hash_find_combined(&r->virtual_names->names, hash, server, len); | 1639 cscf = ngx_hash_find_combined(&vn->names, hash, server, len); |
1642 | 1640 |
1643 if (cscf) { | 1641 if (cscf) { |
1644 goto found; | 1642 goto found; |
1645 } | 1643 } |
1646 | 1644 |
1647 #if (NGX_PCRE) | 1645 #if (NGX_PCRE) |
1648 | 1646 |
1649 if (r->virtual_names->nregex) { | 1647 if (vn->nregex) { |
1650 ngx_int_t n; | 1648 ngx_int_t n; |
1651 ngx_uint_t i; | 1649 ngx_uint_t i; |
1652 ngx_str_t name; | 1650 ngx_str_t name; |
1653 ngx_http_server_name_t *sn; | 1651 ngx_http_server_name_t *sn; |
1654 | 1652 |
1655 name.len = len; | 1653 name.len = len; |
1656 name.data = server; | 1654 name.data = server; |
1657 | 1655 |
1658 sn = r->virtual_names->regex; | 1656 sn = vn->regex; |
1659 | 1657 |
1660 for (i = 0; i < r->virtual_names->nregex; i++) { | 1658 for (i = 0; i < vn->nregex; i++) { |
1661 | 1659 |
1662 n = ngx_regex_exec(sn[i].regex, &name, NULL, 0); | 1660 n = ngx_regex_exec(sn[i].regex, &name, NULL, 0); |
1663 | 1661 |
1664 if (n == NGX_REGEX_NO_MATCHED) { | 1662 if (n == NGX_REGEX_NO_MATCHED) { |
1665 continue; | 1663 continue; |