changeset 1757:ce8b0c9452ae

Tests: added extended js internalRedirect tests.
author Dmitry Volyntsev <xeioex@nginx.com>
date Thu, 28 Apr 2022 17:20:27 -0700
parents 6966f099068d
children 7c727869aeda
files js_internal_redirect.t
diffstat 1 files changed, 17 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/js_internal_redirect.t
+++ b/js_internal_redirect.t
@@ -63,6 +63,12 @@ EOF
         if (r.variables.arg_dest == 'named') {
             r.internalRedirect('\@named');
 
+        } else if (r.variables.arg_unsafe) {
+            r.internalRedirect('/red\0rect');
+
+        } else if (r.variables.arg_quoted) {
+            r.internalRedirect('/red%69rect');
+
         } else {
             if (r.variables.arg_a) {
                 r.internalRedirect('/redirect?b=' + r.variables.arg_a);
@@ -77,7 +83,7 @@ EOF
 
 EOF
 
-$t->try_run('no njs available')->plan(3);
+$t->try_run('no njs available')->plan(5);
 
 ###############################################################################
 
@@ -85,4 +91,14 @@ like(http_get('/test'), qr/redirect/s, '
 like(http_get('/test?a=A'), qr/redirectA/s, 'redirect with args');
 like(http_get('/test?dest=named'), qr/named/s, 'redirect to named location');
 
+TODO: {
+local $TODO = 'not yet'
+	unless http_get('/njs') =~ /^([.0-9]+)$/m && $1 ge '0.7.4';
+
+like(http_get('/test?unsafe=1'), qr/500 Internal Server/s,
+	'unsafe redirect');
+like(http_get('/test?quoted=1'), qr/200 .*redirect/s,
+	'quoted redirect');
+}
+
 ###############################################################################