comparison src/http/ngx_http_request.c @ 650:4d05413aebad NGINX_1_1_9

nginx 1.1.9 *) Change: now double quotes are encoded in an "echo" SSI-command output. Thanks to Zaur Abasmirzoev. *) Feature: the "valid" parameter of the "resolver" directive. By default TTL returned by a DNS server is used. Thanks to Kirill A. Korinskiy. *) Bugfix: nginx might hang after a worker process abnormal termination. *) Bugfix: a segmentation fault might occur in a worker process if SNI was used; the bug had appeared in 1.1.2. *) Bugfix: in the "keepalive_disable" directive; the bug had appeared in 1.1.8. Thanks to Alexander Usov. *) Bugfix: SIGWINCH signal did not work after first binary upgrade; the bug had appeared in 1.1.1. *) Bugfix: backend responses with length not matching "Content-Length" header line are no longer cached. *) Bugfix: in the "scgi_param" directive, if complex parameters were used. *) Bugfix: in the "epoll" event method. Thanks to Yichun Zhang. *) Bugfix: in the ngx_http_flv_module. Thanks to Piotr Sikora. *) Bugfix: in the ngx_http_mp4_module. *) Bugfix: IPv6 addresses are now handled properly in a request line and in a "Host" request header line. *) Bugfix: "add_header" and "expires" directives did not work if a request was proxied and response status code was 206. *) Bugfix: nginx could not be built on FreeBSD 10. *) Bugfix: nginx could not be built on AIX.
author Igor Sysoev <http://sysoev.ru>
date Mon, 28 Nov 2011 00:00:00 +0400
parents 6f21ae02fb01
children d0f7a625f27c
comparison
equal deleted inserted replaced
649:c5b99ec117cd 650:4d05413aebad
669 return SSL_TLSEXT_ERR_NOACK; 669 return SSL_TLSEXT_ERR_NOACK;
670 } 670 }
671 671
672 sscf = ngx_http_get_module_srv_conf(r, ngx_http_ssl_module); 672 sscf = ngx_http_get_module_srv_conf(r, ngx_http_ssl_module);
673 673
674 SSL_set_SSL_CTX(ssl_conn, sscf->ssl.ctx); 674 if (sscf->ssl.ctx) {
675 675 SSL_set_SSL_CTX(ssl_conn, sscf->ssl.ctx);
676 /* 676
677 * SSL_set_SSL_CTX() only changes certs as of 1.0.0d 677 /*
678 * adjust other things we care about 678 * SSL_set_SSL_CTX() only changes certs as of 1.0.0d
679 */ 679 * adjust other things we care about
680 680 */
681 SSL_set_verify(ssl_conn, SSL_CTX_get_verify_mode(sscf->ssl.ctx), 681
682 SSL_CTX_get_verify_callback(sscf->ssl.ctx)); 682 SSL_set_verify(ssl_conn, SSL_CTX_get_verify_mode(sscf->ssl.ctx),
683 683 SSL_CTX_get_verify_callback(sscf->ssl.ctx));
684 SSL_set_verify_depth(ssl_conn, SSL_CTX_get_verify_depth(sscf->ssl.ctx)); 684
685 SSL_set_verify_depth(ssl_conn, SSL_CTX_get_verify_depth(sscf->ssl.ctx));
685 686
686 #ifdef SSL_CTRL_CLEAR_OPTIONS 687 #ifdef SSL_CTRL_CLEAR_OPTIONS
687 /* only in 0.9.8m+ */ 688 /* only in 0.9.8m+ */
688 SSL_clear_options(ssl_conn, SSL_get_options(ssl_conn) & 689 SSL_clear_options(ssl_conn, SSL_get_options(ssl_conn) &
689 ~SSL_CTX_get_options(sscf->ssl.ctx)); 690 ~SSL_CTX_get_options(sscf->ssl.ctx));
690 #endif 691 #endif
691 692
692 SSL_set_options(ssl_conn, SSL_CTX_get_options(sscf->ssl.ctx)); 693 SSL_set_options(ssl_conn, SSL_CTX_get_options(sscf->ssl.ctx));
694 }
693 695
694 return SSL_TLSEXT_ERR_OK; 696 return SSL_TLSEXT_ERR_OK;
695 } 697 }
696 698
697 #endif 699 #endif
1670 1672
1671 static ssize_t 1673 static ssize_t
1672 ngx_http_validate_host(ngx_http_request_t *r, u_char **host, size_t len, 1674 ngx_http_validate_host(ngx_http_request_t *r, u_char **host, size_t len,
1673 ngx_uint_t alloc) 1675 ngx_uint_t alloc)
1674 { 1676 {
1675 u_char *h, ch; 1677 u_char *h, ch;
1676 size_t i, last; 1678 size_t i, dot_pos, host_len;
1677 ngx_uint_t dot; 1679
1678 1680 enum {
1679 last = len; 1681 sw_usual = 0,
1682 sw_literal,
1683 sw_rest
1684 } state;
1685
1686 dot_pos = len;
1687 host_len = len;
1688
1680 h = *host; 1689 h = *host;
1681 dot = 0; 1690
1691 state = sw_usual;
1682 1692
1683 for (i = 0; i < len; i++) { 1693 for (i = 0; i < len; i++) {
1684 ch = h[i]; 1694 ch = h[i];
1685 1695
1686 if (ch == '.') { 1696 switch (ch) {
1687 if (dot) { 1697
1698 case '.':
1699 if (dot_pos == i - 1) {
1688 return 0; 1700 return 0;
1689 } 1701 }
1690 1702 dot_pos = i;
1691 dot = 1; 1703 break;
1692 continue; 1704
1693 } 1705 case ':':
1694 1706 if (state == sw_usual) {
1695 dot = 0; 1707 host_len = i;
1696 1708 state = sw_rest;
1697 if (ch == ':') { 1709 }
1698 last = i; 1710 break;
1699 continue; 1711
1700 } 1712 case '[':
1701 1713 if (i == 0) {
1702 if (ngx_path_separator(ch) || ch == '\0') { 1714 state = sw_literal;
1715 }
1716 break;
1717
1718 case ']':
1719 if (state == sw_literal) {
1720 host_len = i + 1;
1721 state = sw_rest;
1722 }
1723 break;
1724
1725 case '\0':
1703 return 0; 1726 return 0;
1704 } 1727
1705 1728 default:
1706 if (ch >= 'A' || ch < 'Z') { 1729
1707 alloc = 1; 1730 if (ngx_path_separator(ch)) {
1708 } 1731 return 0;
1709 } 1732 }
1710 1733
1711 if (dot) { 1734 if (ch >= 'A' && ch <= 'Z') {
1712 last--; 1735 alloc = 1;
1736 }
1737
1738 break;
1739 }
1740 }
1741
1742 if (dot_pos == host_len - 1) {
1743 host_len--;
1713 } 1744 }
1714 1745
1715 if (alloc) { 1746 if (alloc) {
1716 *host = ngx_pnalloc(r->pool, last) ; 1747 *host = ngx_pnalloc(r->pool, host_len);
1717 if (*host == NULL) { 1748 if (*host == NULL) {
1718 return -1; 1749 return -1;
1719 } 1750 }
1720 1751
1721 ngx_strlow(*host, h, last); 1752 ngx_strlow(*host, h, host_len);
1722 } 1753 }
1723 1754
1724 return last; 1755 return host_len;
1725 } 1756 }
1726 1757
1727 1758
1728 static ngx_int_t 1759 static ngx_int_t
1729 ngx_http_find_virtual_server(ngx_http_request_t *r, u_char *host, size_t len) 1760 ngx_http_find_virtual_server(ngx_http_request_t *r, u_char *host, size_t len)