# HG changeset patch # User Yaroslav Zhuravlev # Date 1405353836 -14400 # Node ID ac1b01d37929e5f804fecdcffd1dfb949e1f5f0e # Parent 9fbe66ff4f7cd971dbdea627efdf055542080926 Perl module: removed info specific to nginx 0.6.22 and earlier. diff -r 9fbe66ff4f7c -r ac1b01d37929 xml/en/docs/http/ngx_http_perl_module.xml --- a/xml/en/docs/http/ngx_http_perl_module.xml Mon Jul 14 17:12:06 2014 +0400 +++ b/xml/en/docs/http/ngx_http_perl_module.xml Mon Jul 14 20:03:56 2014 +0400 @@ -10,7 +10,7 @@ + rev="3">
@@ -80,57 +80,6 @@ accessing the local file system. - -The issues mentioned below affect only the nginx versions before 0.6.22. - - -The $r request object methods return -data only as a string value, and the value itself is stored in memory -allocated by nginx from its own pools, not by Perl. -This helps to reduce the number of copy operations involved in -most cases; however it can lead to errors in some cases. -For example, a worker process trying to use such data in the -numeric context will terminate with an error (FreeBSD): - -nginx in realloc(): warning: pointer to wrong page -Out of memory! -Callback called exit. - -or (Linux): - -*** glibc detected *** realloc(): invalid pointer: ... *** -Out of memory! -Callback called exit. - -The workaround is simple — the method’s value should be assigned -to a variable. -For example, the following code - -my $i = $r->variable('counter') + 1; - -should be replaced by - -my $i = $r->variable('counter'); -$i++; - - - - -Since most strings inside nginx are stored without a terminating null -character, they are similarly returned by the $r request -object methods (except for the $r->filename and -$r->request_body_file methods). -Thus, such values cannot be used as filenames and the likes. -The workaround is similar to the previous case — the value should either be -assigned to a variable (this results in data copying and adding of -the necessary null character) or used in an expression, for example: - -open FILE, '/path/' . $r->variable('name'); - - - - -
diff -r 9fbe66ff4f7c -r ac1b01d37929 xml/ru/docs/http/ngx_http_perl_module.xml --- a/xml/ru/docs/http/ngx_http_perl_module.xml Mon Jul 14 17:12:06 2014 +0400 +++ b/xml/ru/docs/http/ngx_http_perl_module.xml Mon Jul 14 20:03:56 2014 +0400 @@ -10,7 +10,7 @@ + rev="3">
@@ -81,57 +81,6 @@ к локальной файловой системе. - -Нижеописанные проблемы относятся только к версиям nginx до 0.6.22. - - -Данные, возвращаемые методами объекта запроса $r, -имеют только текстовое значение, причём само значение хранится -в памяти, выделяемой не Perl, а nginx из собственных пулов. -Это позволяет уменьшить число операций копирования в большинстве случаев, -однако в некоторых ситуациях это приводит к ошибке. -Например, при попытке использования таких значений в числовом контексте -рабочий процесс выходит с ошибкой (FreeBSD): - -nginx in realloc(): warning: pointer to wrong page -Out of memory! -Callback called exit. - -или (Linux): - -*** glibc detected *** realloc(): invalid pointer: ... *** -Out of memory! -Callback called exit. - -Обойти такую ситуацию просто: нужно присвоить значение метода -переменной, например, такой код - -my $i = $r->variable('counter') + 1; - -нужно заменить на - -my $i = $r->variable('counter'); -$i++; - - - - -Так как строки внутри nginx в большинстве случаев хранятся без -завершающего нуля, то они в таком же виде возвращаются и методами -объекта запроса $r (исключения составляют методы -$r->filename и $r->request_body_file). -Поэтому такие значения нельзя использовать -в качестве имени файла и тому подобного. -Обойти это можно так же, как в предыдущей ситуации: присвоив значение -переменной (при этом происходит копирование данных и добавление необходимого -нуля) или же использовав его в выражении, например: - -open FILE, '/path/' . $r->variable('name'); - - - - -