diff options
author | Maxim Dounin <mdounin@mdounin.ru> | 2019-07-12 15:39:26 +0300 |
---|---|---|
committer | Maxim Dounin <mdounin@mdounin.ru> | 2019-07-12 15:39:26 +0300 |
commit | 8df08b02b89c151e4bf04bc3c7c9a37e9ebcba9d (patch) | |
tree | 2e5b9d2fa8d3bf8ceea46de37158e711c5877034 /src/http/modules/perl/ngx_http_perl_module.c | |
parent | 9e883a2e48ff8e55fcfb091284b44d8fa66fc007 (diff) | |
download | nginx-8df08b02b89c151e4bf04bc3c7c9a37e9ebcba9d.tar.gz nginx-8df08b02b89c151e4bf04bc3c7c9a37e9ebcba9d.zip |
Perl: expect escaped URIs in $r->internal_redirect().
Similarly to the change in 5491:74bfa803a5aa (1.5.9), we should accept
properly escaped URIs and unescape them as needed, else it is not possible
to handle URIs with question marks.
Diffstat (limited to 'src/http/modules/perl/ngx_http_perl_module.c')
-rw-r--r-- | src/http/modules/perl/ngx_http_perl_module.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/http/modules/perl/ngx_http_perl_module.c b/src/http/modules/perl/ngx_http_perl_module.c index d2a0dfae5..a123e3875 100644 --- a/src/http/modules/perl/ngx_http_perl_module.c +++ b/src/http/modules/perl/ngx_http_perl_module.c @@ -184,6 +184,7 @@ ngx_http_perl_handle_request(ngx_http_request_t *r) SV *sub; ngx_int_t rc; ngx_str_t uri, args, *handler; + ngx_uint_t flags; ngx_http_perl_ctx_t *ctx; ngx_http_perl_loc_conf_t *plcf; ngx_http_perl_main_conf_t *pmcf; @@ -237,7 +238,6 @@ ngx_http_perl_handle_request(ngx_http_request_t *r) if (ctx->redirect_uri.len) { uri = ctx->redirect_uri; - args = ctx->redirect_args; } else { uri.len = 0; @@ -257,6 +257,14 @@ ngx_http_perl_handle_request(ngx_http_request_t *r) } if (uri.len) { + ngx_str_null(&args); + flags = NGX_HTTP_LOG_UNSAFE; + + if (ngx_http_parse_unsafe_uri(r, &uri, &args, &flags) != NGX_OK) { + ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); + return; + } + ngx_http_internal_redirect(r, &uri, &args); ngx_http_finalize_request(r, NGX_DONE); return; |