Mercurial > hg > nginx
comparison src/http/modules/perl/ngx_http_perl_module.c @ 7532:975d7ab37b39
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.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Fri, 12 Jul 2019 15:39:26 +0300 |
parents | ede052c67512 |
children | 5f642712e7ad |
comparison
equal
deleted
inserted
replaced
7531:ede052c67512 | 7532:975d7ab37b39 |
---|---|
182 ngx_http_perl_handle_request(ngx_http_request_t *r) | 182 ngx_http_perl_handle_request(ngx_http_request_t *r) |
183 { | 183 { |
184 SV *sub; | 184 SV *sub; |
185 ngx_int_t rc; | 185 ngx_int_t rc; |
186 ngx_str_t uri, args, *handler; | 186 ngx_str_t uri, args, *handler; |
187 ngx_uint_t flags; | |
187 ngx_http_perl_ctx_t *ctx; | 188 ngx_http_perl_ctx_t *ctx; |
188 ngx_http_perl_loc_conf_t *plcf; | 189 ngx_http_perl_loc_conf_t *plcf; |
189 ngx_http_perl_main_conf_t *pmcf; | 190 ngx_http_perl_main_conf_t *pmcf; |
190 | 191 |
191 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "perl handler"); | 192 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "perl handler"); |
235 rc = NGX_OK; | 236 rc = NGX_OK; |
236 } | 237 } |
237 | 238 |
238 if (ctx->redirect_uri.len) { | 239 if (ctx->redirect_uri.len) { |
239 uri = ctx->redirect_uri; | 240 uri = ctx->redirect_uri; |
240 args = ctx->redirect_args; | |
241 | 241 |
242 } else { | 242 } else { |
243 uri.len = 0; | 243 uri.len = 0; |
244 } | 244 } |
245 | 245 |
255 ngx_http_finalize_request(r, NGX_DONE); | 255 ngx_http_finalize_request(r, NGX_DONE); |
256 return; | 256 return; |
257 } | 257 } |
258 | 258 |
259 if (uri.len) { | 259 if (uri.len) { |
260 ngx_str_null(&args); | |
261 flags = NGX_HTTP_LOG_UNSAFE; | |
262 | |
263 if (ngx_http_parse_unsafe_uri(r, &uri, &args, &flags) != NGX_OK) { | |
264 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); | |
265 return; | |
266 } | |
267 | |
260 ngx_http_internal_redirect(r, &uri, &args); | 268 ngx_http_internal_redirect(r, &uri, &args); |
261 ngx_http_finalize_request(r, NGX_DONE); | 269 ngx_http_finalize_request(r, NGX_DONE); |
262 return; | 270 return; |
263 } | 271 } |
264 | 272 |