Mercurial > hg > nginx-site
changeset 1251:ac1b01d37929
Perl module: removed info specific to nginx 0.6.22 and earlier.
author | Yaroslav Zhuravlev <yar@nginx.com> |
---|---|
date | Mon, 14 Jul 2014 20:03:56 +0400 |
parents | 9fbe66ff4f7c |
children | 27b22e625491 |
files | xml/en/docs/http/ngx_http_perl_module.xml xml/ru/docs/http/ngx_http_perl_module.xml |
diffstat | 2 files changed, 2 insertions(+), 104 deletions(-) [+] |
line wrap: on
line diff
--- 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 @@ <module name="Module ngx_http_perl_module" link="/en/docs/http/ngx_http_perl_module.html" lang="en" - rev="2"> + rev="3"> <section id="summary"> @@ -80,57 +80,6 @@ accessing the local file system. </para> -<para> -The issues mentioned below affect only the nginx versions before 0.6.22. - -<note> -The <literal>$r</literal> 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): -<example> -nginx in realloc(): warning: pointer to wrong page -Out of memory! -Callback called exit. -</example> -or (Linux): -<example> -*** glibc detected *** realloc(): invalid pointer: ... *** -Out of memory! -Callback called exit. -</example> -The workaround is simple — the method’s value should be assigned -to a variable. -For example, the following code -<example> -my $i = $r->variable('counter') + 1; -</example> -should be replaced by -<example> -my $i = $r->variable('counter'); -$i++; -</example> -</note> - -<note> -Since most strings inside nginx are stored without a terminating null -character, they are similarly returned by the <literal>$r</literal> request -object methods (except for the <literal>$r->filename</literal> and -<literal>$r->request_body_file</literal> 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: -<example> -open FILE, '/path/' . $r->variable('name'); -</example> -</note> - -</para> - </section>
--- 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 @@ <module name="Модуль ngx_http_perl_module" link="/ru/docs/http/ngx_http_perl_module.html" lang="ru" - rev="2"> + rev="3"> <section id="summary"> @@ -81,57 +81,6 @@ к локальной файловой системе. </para> -<para> -Нижеописанные проблемы относятся только к версиям nginx до 0.6.22. - -<note> -Данные, возвращаемые методами объекта запроса <literal>$r</literal>, -имеют только текстовое значение, причём само значение хранится -в памяти, выделяемой не Perl, а nginx из собственных пулов. -Это позволяет уменьшить число операций копирования в большинстве случаев, -однако в некоторых ситуациях это приводит к ошибке. -Например, при попытке использования таких значений в числовом контексте -рабочий процесс выходит с ошибкой (FreeBSD): -<example> -nginx in realloc(): warning: pointer to wrong page -Out of memory! -Callback called exit. -</example> -или (Linux): -<example> -*** glibc detected *** realloc(): invalid pointer: ... *** -Out of memory! -Callback called exit. -</example> -Обойти такую ситуацию просто: нужно присвоить значение метода -переменной, например, такой код -<example> -my $i = $r->variable('counter') + 1; -</example> -нужно заменить на -<example> -my $i = $r->variable('counter'); -$i++; -</example> -</note> - -<note> -Так как строки внутри nginx в большинстве случаев хранятся без -завершающего нуля, то они в таком же виде возвращаются и методами -объекта запроса <literal>$r</literal> (исключения составляют методы -<literal>$r->filename</literal> и <literal>$r->request_body_file</literal>). -Поэтому такие значения нельзя использовать -в качестве имени файла и тому подобного. -Обойти это можно так же, как в предыдущей ситуации: присвоив значение -переменной (при этом происходит копирование данных и добавление необходимого -нуля) или же использовав его в выражении, например: -<example> -open FILE, '/path/' . $r->variable('name'); -</example> -</note> - -</para> - </section>