ПРОЕКТЫ 


  АРХИВ 


Apache-Talk @lexa.ru 

Inet-Admins @info.east.ru 

Filmscanners @halftone.co.uk 

Security-alerts @yandex-team.ru 

nginx-ru @sysoev.ru 


  СТАТЬИ 


  ПЕРСОНАЛЬНОЕ 


  ПРОГРАММЫ 



ПИШИТЕ
ПИСЬМА












     АРХИВ :: nginx-ru
Nginx-ru mailing list archive (nginx-ru@sysoev.ru)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: nginx-0.7.9



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
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;
         }
 


 




Copyright © Lexa Software, 1996-2009.