comparison src/http/ngx_http.c @ 554:5c576ea5dbd9 NGINX_0_8_29

nginx 0.8.29 *) Change: now the "009" status code is written to an access log for proxied HTTP/0.9 responses. *) Feature: the "addition_types", "charset_types", "gzip_types", "ssi_types", "sub_filter_types", and "xslt_types" directives support an "*" parameter. *) Feature: GCC 4.1+ built-in atomic operations usage. Thanks to W-Mark Kubacki. *) Feature: the --with-libatomic[=DIR] option in the configure. Thanks to W-Mark Kubacki. *) Bugfix: listen unix domain socket had limited access rights. *) Bugfix: cached HTTP/0.9 responses were handled incorrectly. *) Bugfix: regular expression named captures given by "?P<...>" did not work in a "server_name" directive. Thanks to Maxim Dounin.
author Igor Sysoev <http://sysoev.ru>
date Mon, 30 Nov 2009 00:00:00 +0300
parents c04fa65fe604
children 2da4537168f8
comparison
equal deleted inserted replaced
553:63dde5a94756 554:5c576ea5dbd9
1852 ngx_uint_t i, n, hash; 1852 ngx_uint_t i, n, hash;
1853 ngx_hash_key_t *type; 1853 ngx_hash_key_t *type;
1854 1854
1855 types = (ngx_array_t **) (p + cmd->offset); 1855 types = (ngx_array_t **) (p + cmd->offset);
1856 1856
1857 if (*types == (void *) -1) {
1858 return NGX_CONF_OK;
1859 }
1860
1857 default_type = cmd->post; 1861 default_type = cmd->post;
1858 1862
1859 if (*types == NULL) { 1863 if (*types == NULL) {
1860 *types = ngx_array_create(cf->temp_pool, 1, sizeof(ngx_hash_key_t)); 1864 *types = ngx_array_create(cf->temp_pool, 1, sizeof(ngx_hash_key_t));
1861 if (*types == NULL) { 1865 if (*types == NULL) {
1877 1881
1878 value = cf->args->elts; 1882 value = cf->args->elts;
1879 1883
1880 for (i = 1; i < cf->args->nelts; i++) { 1884 for (i = 1; i < cf->args->nelts; i++) {
1881 1885
1886 if (value[i].len == 1 && value[i].data[0] == '*') {
1887 *types = (void *) -1;
1888 return NGX_CONF_OK;
1889 }
1890
1882 hash = ngx_hash_strlow(value[i].data, value[i].data, value[i].len); 1891 hash = ngx_hash_strlow(value[i].data, value[i].data, value[i].len);
1883 value[i].data[value[i].len] = '\0'; 1892 value[i].data[value[i].len] = '\0';
1884 1893
1885 type = (*types)->elts; 1894 type = (*types)->elts;
1886 for (n = 0; n < (*types)->nelts; n++) { 1895 for (n = 0; n < (*types)->nelts; n++) {
1905 return NGX_CONF_OK; 1914 return NGX_CONF_OK;
1906 } 1915 }
1907 1916
1908 1917
1909 char * 1918 char *
1910 ngx_http_merge_types(ngx_conf_t *cf, ngx_array_t *keys, ngx_hash_t *types_hash, 1919 ngx_http_merge_types(ngx_conf_t *cf, ngx_array_t **keys, ngx_hash_t *types_hash,
1911 ngx_array_t *prev_keys, ngx_hash_t *prev_types_hash, 1920 ngx_array_t **prev_keys, ngx_hash_t *prev_types_hash,
1912 ngx_str_t *default_types) 1921 ngx_str_t *default_types)
1913 { 1922 {
1914 ngx_hash_init_t hash; 1923 ngx_hash_init_t hash;
1915 1924
1916 if (keys) { 1925 if (*keys) {
1926
1927 if (*keys == (void *) -1) {
1928 return NGX_CONF_OK;
1929 }
1917 1930
1918 hash.hash = types_hash; 1931 hash.hash = types_hash;
1919 hash.key = NULL; 1932 hash.key = NULL;
1920 hash.max_size = 2048; 1933 hash.max_size = 2048;
1921 hash.bucket_size = 64; 1934 hash.bucket_size = 64;
1922 hash.name = "test_types_hash"; 1935 hash.name = "test_types_hash";
1923 hash.pool = cf->pool; 1936 hash.pool = cf->pool;
1924 hash.temp_pool = NULL; 1937 hash.temp_pool = NULL;
1925 1938
1926 if (ngx_hash_init(&hash, keys->elts, keys->nelts) != NGX_OK) { 1939 if (ngx_hash_init(&hash, (*keys)->elts, (*keys)->nelts) != NGX_OK) {
1927 return NGX_CONF_ERROR; 1940 return NGX_CONF_ERROR;
1928 } 1941 }
1929 1942
1930 return NGX_CONF_OK; 1943 return NGX_CONF_OK;
1931 } 1944 }
1932 1945
1933 if (prev_types_hash->buckets == NULL) { 1946 if (prev_types_hash->buckets == NULL) {
1934 1947
1935 if (prev_keys == NULL) { 1948 if (*prev_keys == NULL) {
1936 1949
1937 if (ngx_http_set_default_types(cf, &prev_keys, default_types) 1950 if (ngx_http_set_default_types(cf, prev_keys, default_types)
1938 != NGX_OK) 1951 != NGX_OK)
1939 { 1952 {
1940 return NGX_CONF_ERROR; 1953 return NGX_CONF_ERROR;
1941 } 1954 }
1955
1956 } else if (*prev_keys == (void *) -1) {
1957 *keys = *prev_keys;
1958 return NGX_CONF_OK;
1942 } 1959 }
1943 1960
1944 hash.hash = prev_types_hash; 1961 hash.hash = prev_types_hash;
1945 hash.key = NULL; 1962 hash.key = NULL;
1946 hash.max_size = 2048; 1963 hash.max_size = 2048;
1947 hash.bucket_size = 64; 1964 hash.bucket_size = 64;
1948 hash.name = "test_types_hash"; 1965 hash.name = "test_types_hash";
1949 hash.pool = cf->pool; 1966 hash.pool = cf->pool;
1950 hash.temp_pool = NULL; 1967 hash.temp_pool = NULL;
1951 1968
1952 if (ngx_hash_init(&hash, prev_keys->elts, prev_keys->nelts) != NGX_OK) { 1969 if (ngx_hash_init(&hash, (*prev_keys)->elts, (*prev_keys)->nelts)
1970 != NGX_OK)
1971 {
1953 return NGX_CONF_ERROR; 1972 return NGX_CONF_ERROR;
1954 } 1973 }
1955 } 1974 }
1956 1975
1957 *types_hash = *prev_types_hash; 1976 *types_hash = *prev_types_hash;