Mercurial > hg > nginx
comparison src/http/modules/perl/ngx_http_perl_module.c @ 7528:0cb693b4cbbb
Perl: disabled unrelated calls from variable handlers.
Variable handlers are not expected to send anything to the client, cannot
sleep or read body, and are not expected to modify the request. Added
appropriate protection to prevent accidental foot shooting.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Fri, 12 Jul 2019 15:35:31 +0300 |
parents | 575480d3fd01 |
children | d758d04e0790 |
comparison
equal
deleted
inserted
replaced
7527:02cd116ebe2a | 7528:0cb693b4cbbb |
---|---|
300 { | 300 { |
301 ngx_http_perl_variable_t *pv = (ngx_http_perl_variable_t *) data; | 301 ngx_http_perl_variable_t *pv = (ngx_http_perl_variable_t *) data; |
302 | 302 |
303 ngx_int_t rc; | 303 ngx_int_t rc; |
304 ngx_str_t value; | 304 ngx_str_t value; |
305 ngx_uint_t saved; | |
305 ngx_http_perl_ctx_t *ctx; | 306 ngx_http_perl_ctx_t *ctx; |
306 ngx_http_perl_main_conf_t *pmcf; | 307 ngx_http_perl_main_conf_t *pmcf; |
307 | 308 |
308 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | 309 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
309 "perl variable handler"); | 310 "perl variable handler"); |
318 | 319 |
319 ngx_http_set_ctx(r, ctx, ngx_http_perl_module); | 320 ngx_http_set_ctx(r, ctx, ngx_http_perl_module); |
320 | 321 |
321 ctx->request = r; | 322 ctx->request = r; |
322 } | 323 } |
324 | |
325 saved = ctx->variable; | |
326 ctx->variable = 1; | |
323 | 327 |
324 pmcf = ngx_http_get_module_main_conf(r, ngx_http_perl_module); | 328 pmcf = ngx_http_get_module_main_conf(r, ngx_http_perl_module); |
325 | 329 |
326 value.data = NULL; | 330 value.data = NULL; |
327 | 331 |
345 | 349 |
346 } else { | 350 } else { |
347 v->not_found = 1; | 351 v->not_found = 1; |
348 } | 352 } |
349 | 353 |
354 ctx->variable = saved; | |
350 ctx->filename.data = NULL; | 355 ctx->filename.data = NULL; |
351 ctx->redirect_uri.len = 0; | 356 ctx->redirect_uri.len = 0; |
352 | 357 |
353 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | 358 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
354 "perl variable done"); | 359 "perl variable done"); |