[nginx] Perl: named locations in $r->internal_redirect().

Maxim Dounin mdounin at mdounin.ru
Fri Jul 12 14:54:05 UTC 2019


details:   https://hg.nginx.org/nginx/rev/5f642712e7ad
branches:  
changeset: 7533:5f642712e7ad
user:      Maxim Dounin <mdounin at mdounin.ru>
date:      Fri Jul 12 15:39:28 2019 +0300
description:
Perl: named locations in $r->internal_redirect().

diffstat:

 src/http/modules/perl/ngx_http_perl_module.c |  18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)

diffs (31 lines):

diff --git a/src/http/modules/perl/ngx_http_perl_module.c b/src/http/modules/perl/ngx_http_perl_module.c
--- a/src/http/modules/perl/ngx_http_perl_module.c
+++ b/src/http/modules/perl/ngx_http_perl_module.c
@@ -257,15 +257,21 @@ ngx_http_perl_handle_request(ngx_http_re
     }
 
     if (uri.len) {
-        ngx_str_null(&args);
-        flags = NGX_HTTP_LOG_UNSAFE;
+        if (uri.data[0] == '@') {
+            ngx_http_named_location(r, &uri);
+
+        } else {
+            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;
+            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_internal_redirect(r, &uri, &args);
         ngx_http_finalize_request(r, NGX_DONE);
         return;
     }


More information about the nginx-devel mailing list