-- Патч добавляет оператор "-l" в модуль ngx_http_rewrite_module, который возвращает true, -- если длина файл больше нуля (by BOLK, 2007.06.20) diff -urd --ignore-blank-lines --minimal src/http/ngx_http_script.c.old src/http/ngx_http_script.c --- src/http/ngx_http_script.c.old 2007-06-21 18:15:35.000000000 +0400 +++ src/http/ngx_http_script.c 2007-06-21 18:16:11.000000000 +0400 @@ -979,12 +979,14 @@ case ngx_http_script_file_dir: case ngx_http_script_file_exists: case ngx_http_script_file_exec: + case ngx_http_script_file_size: goto false; case ngx_http_script_file_not_plain: case ngx_http_script_file_not_dir: case ngx_http_script_file_not_exists: case ngx_http_script_file_not_exec: + case ngx_http_script_file_not_size: goto true; } @@ -1028,6 +1030,18 @@ } goto true; + case ngx_http_script_file_size: + if (ngx_file_size(&fi)) { + goto true; + } + goto false; + + case ngx_http_script_file_not_size: + if (ngx_file_size(&fi)) { + goto false; + } + goto true; + #if (NGX_WIN32) case ngx_http_script_file_exec: diff -urd --ignore-blank-lines --minimal src/http/modules/ngx_http_rewrite_module.c.old src/http/modules/ngx_http_rewrite_module.c --- src/http/modules/ngx_http_rewrite_module.c.old 2007-06-21 18:15:52.000000000 +0400 +++ src/http/modules/ngx_http_rewrite_module.c 2007-06-21 18:16:24.000000000 +0400 @@ -839,6 +839,11 @@ return NGX_CONF_OK; } + if (p[1] == 'l') { + fop->op = ngx_http_script_file_size; + return NGX_CONF_OK; + } + if (p[0] == '!') { if (p[2] == 'f') { fop->op = ngx_http_script_file_not_plain; @@ -859,6 +864,11 @@ fop->op = ngx_http_script_file_not_exec; return NGX_CONF_OK; } + + if (p[2] == 'l') { + fop->op = ngx_http_script_file_not_size; + return NGX_CONF_OK; + } } ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, diff -urd --ignore-blank-lines --minimal src/http/ngx_http_script.h.old src/http/ngx_http_script.h --- src/http/ngx_http_script.h.old 2007-06-21 18:19:46.000000000 +0400 +++ src/http/ngx_http_script.h 2007-06-21 18:20:11.000000000 +0400 @@ -146,7 +146,9 @@ ngx_http_script_file_exists, ngx_http_script_file_not_exists, ngx_http_script_file_exec, - ngx_http_script_file_not_exec + ngx_http_script_file_not_exec, + ngx_http_script_file_size, + ngx_http_script_file_not_size } ngx_http_script_file_op_e;