comparison src/http/ngx_http_request.c @ 546:e19e5f542878 NGINX_0_8_25

nginx 0.8.25 *) Change: now no message is written in an error log if a variable is not found by $r->variable() method. *) Feature: the ngx_http_degradation_module. *) Feature: regular expression named captures. *) Feature: now URI part is not required a "proxy_pass" directive if variables are used. *) Feature: now the "msie_padding" directive works for Chrome too. *) Bugfix: a segmentation fault occurred in a worker process on low memory condition; the bug had appeared in 0.8.18. *) Bugfix: nginx sent gzipped responses to clients those do not support gzip, if "gzip_static on" and "gzip_vary off"; the bug had appeared in 0.8.16.
author Igor Sysoev <http://sysoev.ru>
date Mon, 16 Nov 2009 00:00:00 +0300
parents c04fa65fe604
children 7fa8dc2315bd
comparison
equal deleted inserted replaced
545:91e4b06e1a01 546:e19e5f542878
1443 if (!r->headers_in.msie && !r->headers_in.opera) { 1443 if (!r->headers_in.msie && !r->headers_in.opera) {
1444 1444
1445 if (ngx_strstrn(user_agent, "Gecko/", 6 - 1)) { 1445 if (ngx_strstrn(user_agent, "Gecko/", 6 - 1)) {
1446 r->headers_in.gecko = 1; 1446 r->headers_in.gecko = 1;
1447 1447
1448 } else if (ngx_strstrn(user_agent, "Chrome/", 7 - 1)) {
1449 r->headers_in.chrome = 1;
1450
1448 } else if (ngx_strstrn(user_agent, "Konqueror", 9 - 1)) { 1451 } else if (ngx_strstrn(user_agent, "Konqueror", 9 - 1)) {
1449 r->headers_in.konqueror = 1; 1452 r->headers_in.konqueror = 1;
1450 } 1453 }
1451 } 1454 }
1452 1455
1695 } 1698 }
1696 1699
1697 #if (NGX_PCRE) 1700 #if (NGX_PCRE)
1698 1701
1699 if (len && r->virtual_names->nregex) { 1702 if (len && r->virtual_names->nregex) {
1700 size_t ncaptures;
1701 ngx_int_t n; 1703 ngx_int_t n;
1702 ngx_uint_t i; 1704 ngx_uint_t i;
1703 ngx_str_t name; 1705 ngx_str_t name;
1704 ngx_http_server_name_t *sn; 1706 ngx_http_server_name_t *sn;
1705 1707
1706 name.len = len; 1708 name.len = len;
1707 name.data = host; 1709 name.data = host;
1708 1710
1709 ncaptures = 0;
1710
1711 sn = r->virtual_names->regex; 1711 sn = r->virtual_names->regex;
1712 1712
1713 for (i = 0; i < r->virtual_names->nregex; i++) { 1713 for (i = 0; i < r->virtual_names->nregex; i++) {
1714 1714
1715 if (sn[i].server->captures && r->captures == NULL) { 1715 n = ngx_http_regex_exec(r, sn[i].regex, &name);
1716 1716
1717 ncaptures = (NGX_HTTP_MAX_CAPTURES + 1) * 3; 1717 if (n == NGX_OK) {
1718 1718 cscf = sn[i].server;
1719 r->captures = ngx_palloc(r->pool, ncaptures * sizeof(int)); 1719 goto found;
1720 if (r->captures == NULL) { 1720 }
1721 return NGX_ERROR; 1721
1722 } 1722 if (n == NGX_DECLINED) {
1723 }
1724
1725 n = ngx_regex_exec(sn[i].regex, &name, r->captures, ncaptures);
1726
1727 if (n == NGX_REGEX_NO_MATCHED) {
1728 continue; 1723 continue;
1729 } 1724 }
1730 1725
1731 if (n < 0) { 1726 return NGX_ERROR;
1732 ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
1733 ngx_regex_exec_n
1734 " failed: %d on \"%V\" using \"%V\"",
1735 n, &name, &sn[i].name);
1736 return NGX_ERROR;
1737 }
1738
1739 /* match */
1740
1741 cscf = sn[i].server;
1742
1743 r->ncaptures = ncaptures;
1744 r->captures_data = host;
1745
1746 goto found;
1747 } 1727 }
1748 } 1728 }
1749 1729
1750 #endif 1730 #endif
1751 1731