nginx-0.7.9

Igor Sysoev is at rambler-co.ru
Wed Aug 13 10:30:17 MSD 2008


On Wed, Aug 13, 2008 at 12:52:33PM +0700, Denis F. Latypoff wrote:

> Hello Igor,
> 
> Tuesday, August 12, 2008, 10:40:34 PM, you wrote:
> 
> > Изменения в nginx 0.7.9                                           12.08.2008
> 
> >     *) Добавление: теперь директивы gzip_types, ssi_types и
> >        sub_filter_types используют хэш.
> 
> http {
>     gzip                on;
>     gzip_proxied        any;
>     gzip_min_length     0;
>     gzip_types          text/css
>                         text/xml
>                         text/plain
>                         application/xml
>                         application/x-javascript;
> 
>     server {
> 
>         listen          192.168.12.10:80;
>         server_name     megaservername.ru;
> 
> #        location / {
> #            root /path/to/root;
> #        }
>     }
> }
> 
> Делаем запрос на статику '/file.js'. Если location не найден, то
> вываливается корка: 
> 
> #0  0x0804c0bf in ngx_hash_find (hash=0x80b91a8, key=3571849281,
>     name=0x80c21f0 "application/x-javascript", len=24)
>     at src/core/ngx_hash.c:21
> 21          elt = hash->buckets[key % hash->size];

Патч.


-- 
Игорь Сысоев
http://sysoev.ru
-------------- next part --------------
Index: src/http/ngx_http.c
===================================================================
--- src/http/ngx_http.c	(revision 1491)
+++ src/http/ngx_http.c	(working copy)
@@ -1769,7 +1769,25 @@
     if (keys == NULL) {
 
         if (prev_keys) {
+
+            if (prev_types_hash->buckets == NULL) {
+                hash.hash = prev_types_hash;
+                hash.key = NULL;
+                hash.max_size = 2048;
+                hash.bucket_size = 64;
+                hash.name = "test_types_hash";
+                hash.pool = cf->pool;
+                hash.temp_pool = NULL;
+
+                if (ngx_hash_init(&hash, prev_keys->elts, prev_keys->nelts)
+                    != NGX_OK)
+                {
+                    return NGX_CONF_ERROR;
+                }
+            }
+
             *types_hash = *prev_types_hash;
+
             return NGX_CONF_OK;
         }
 


More information about the nginx-ru mailing list