diff options
author | Maxim Dounin <mdounin@mdounin.ru> | 2019-07-12 15:34:37 +0300 |
---|---|---|
committer | Maxim Dounin <mdounin@mdounin.ru> | 2019-07-12 15:34:37 +0300 |
commit | 19887831698e18149a45a8b9563e8fdcdaaea211 (patch) | |
tree | fce19aba3ae6d1ffc7930d3a3d952b36050374c6 /src | |
parent | 9d266efbc0c1170215397ae669165911b5a828d6 (diff) | |
download | nginx-19887831698e18149a45a8b9563e8fdcdaaea211.tar.gz nginx-19887831698e18149a45a8b9563e8fdcdaaea211.zip |
Perl: protection against duplicate $r->sleep() calls.
Duplicate $r->sleep() and/or $r->has_request_body() calls result
in undefined behaviour (in practice, connection leaks were observed).
To prevent this, croak() added in appropriate places.
Diffstat (limited to 'src')
-rw-r--r-- | src/http/modules/perl/nginx.xs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/http/modules/perl/nginx.xs b/src/http/modules/perl/nginx.xs index 104def1e8..e9db2f7d6 100644 --- a/src/http/modules/perl/nginx.xs +++ b/src/http/modules/perl/nginx.xs @@ -400,6 +400,10 @@ has_request_body(r, next) ngx_http_perl_set_request(r, ctx); + if (ctx->next) { + croak("has_request_body(): another handler active"); + } + if (r->headers_in.content_length_n <= 0 && !r->headers_in.chunked) { XSRETURN_UNDEF; } @@ -1093,6 +1097,10 @@ sleep(r, sleep, next) ngx_http_perl_set_request(r, ctx); + if (ctx->next) { + croak("sleep(): another handler active"); + } + sleep = (ngx_msec_t) SvIV(ST(1)); ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |