comparison src/http/ngx_http.c @ 396:349057ecf4d5 NGINX_0_7_10

nginx 0.7.10 *) Bugfix: in the "addition_types", "charset_types", "gzip_types", "ssi_types", "sub_filter_types", and "xslt_types" directives; the bugs had appeared in 0.7.9. *) Bugfix: of recursive error_page for 500 status code. *) Bugfix: now the ngx_http_realip_module set address not for whole keepalive connection, but for each request passed via the connection.
author Igor Sysoev <http://sysoev.ru>
date Wed, 13 Aug 2008 00:00:00 +0400
parents 05981f639d21
children a094317ba307
comparison
equal deleted inserted replaced
395:ebf3256f0c2b 396:349057ecf4d5
1759 } 1759 }
1760 1760
1761 1761
1762 char * 1762 char *
1763 ngx_http_merge_types(ngx_conf_t *cf, ngx_array_t *keys, ngx_hash_t *types_hash, 1763 ngx_http_merge_types(ngx_conf_t *cf, ngx_array_t *keys, ngx_hash_t *types_hash,
1764 ngx_array_t *prev_keys, ngx_hash_t *prev_types_hash, 1764 ngx_array_t *prev_keys, ngx_hash_t *prev_types_hash,
1765 ngx_str_t *default_types) 1765 ngx_str_t *default_types)
1766 { 1766 {
1767 ngx_hash_init_t hash; 1767 ngx_hash_init_t hash;
1768 1768
1769 if (keys == NULL) { 1769 if (keys) {
1770 1770
1771 if (prev_keys) { 1771 hash.hash = types_hash;
1772 *types_hash = *prev_types_hash; 1772 hash.key = NULL;
1773 return NGX_CONF_OK; 1773 hash.max_size = 2048;
1774 } 1774 hash.bucket_size = 64;
1775 1775 hash.name = "test_types_hash";
1776 if (ngx_http_set_default_types(cf, &keys, default_types) 1776 hash.pool = cf->pool;
1777 != NGX_CONF_OK) 1777 hash.temp_pool = NULL;
1778 { 1778
1779 if (ngx_hash_init(&hash, keys->elts, keys->nelts) != NGX_OK) {
1779 return NGX_CONF_ERROR; 1780 return NGX_CONF_ERROR;
1780 } 1781 }
1781 } 1782
1782 1783 return NGX_CONF_OK;
1783 hash.hash = types_hash; 1784 }
1784 hash.key = NULL; 1785
1785 hash.max_size = 2048; 1786 if (prev_types_hash->buckets == NULL) {
1786 hash.bucket_size = 64; 1787
1787 hash.name = "test_types_hash"; 1788 if (prev_keys == NULL) {
1788 hash.pool = cf->pool; 1789
1789 hash.temp_pool = NULL; 1790 if (ngx_http_set_default_types(cf, &prev_keys, default_types)
1790 1791 != NGX_OK)
1791 if (ngx_hash_init(&hash, keys->elts, keys->nelts) != NGX_OK) { 1792 {
1792 return NGX_CONF_ERROR; 1793 return NGX_CONF_ERROR;
1793 } 1794 }
1795 }
1796
1797 hash.hash = prev_types_hash;
1798 hash.key = NULL;
1799 hash.max_size = 2048;
1800 hash.bucket_size = 64;
1801 hash.name = "test_types_hash";
1802 hash.pool = cf->pool;
1803 hash.temp_pool = NULL;
1804
1805 if (ngx_hash_init(&hash, prev_keys->elts, prev_keys->nelts) != NGX_OK) {
1806 return NGX_CONF_ERROR;
1807 }
1808 }
1809
1810 *types_hash = *prev_types_hash;
1794 1811
1795 return NGX_CONF_OK; 1812 return NGX_CONF_OK;
1796 1813
1797 } 1814 }
1798 1815
1799 1816
1800 char * 1817 ngx_int_t
1801 ngx_http_set_default_types(ngx_conf_t *cf, ngx_array_t **types, 1818 ngx_http_set_default_types(ngx_conf_t *cf, ngx_array_t **types,
1802 ngx_str_t *default_type) 1819 ngx_str_t *default_type)
1803 { 1820 {
1804 ngx_hash_key_t *type; 1821 ngx_hash_key_t *type;
1805 1822
1806 *types = ngx_array_create(cf->temp_pool, 1, sizeof(ngx_hash_key_t)); 1823 *types = ngx_array_create(cf->temp_pool, 1, sizeof(ngx_hash_key_t));
1807 if (*types == NULL) { 1824 if (*types == NULL) {
1808 return NGX_CONF_ERROR; 1825 return NGX_ERROR;
1809 } 1826 }
1810 1827
1811 while (default_type->len) { 1828 while (default_type->len) {
1812 1829
1813 type = ngx_array_push(*types); 1830 type = ngx_array_push(*types);
1814 if (type == NULL) { 1831 if (type == NULL) {
1815 return NGX_CONF_ERROR; 1832 return NGX_ERROR;
1816 } 1833 }
1817 1834
1818 type->key = *default_type; 1835 type->key = *default_type;
1819 type->key_hash = ngx_hash_key(default_type->data, 1836 type->key_hash = ngx_hash_key(default_type->data,
1820 default_type->len); 1837 default_type->len);
1821 type->value = (void *) 4; 1838 type->value = (void *) 4;
1822 1839
1823 default_type++; 1840 default_type++;
1824 } 1841 }
1825 1842
1826 return NGX_CONF_OK; 1843 return NGX_OK;
1827 } 1844 }