comparison http_absolute_redirect.t @ 1713:77a9e393ed46

Tests: added one more Location header escaping test.
author Sergey Kandaurov <pluknet@nginx.com>
date Tue, 29 Jun 2021 11:57:40 +0300
parents 0d8531f744bc
children 672018971a62
comparison
equal deleted inserted replaced
1712:0605f9a6f7b0 1713:77a9e393ed46
74 74
75 location "/auto sp/" { 75 location "/auto sp/" {
76 proxy_pass http://127.0.0.1:8080; 76 proxy_pass http://127.0.0.1:8080;
77 } 77 }
78 78
79 location '/auto "#%<>?\^`{|}/' {
80 proxy_pass http://127.0.0.1:8080;
81 }
82
79 location /return301 { 83 location /return301 {
80 return 301 /redirect; 84 return 301 /redirect;
81 } 85 }
82 86
83 location /i/ { 87 location /i/ {
89 EOF 93 EOF
90 94
91 mkdir($t->testdir() . '/dir'); 95 mkdir($t->testdir() . '/dir');
92 mkdir($t->testdir() . '/dir sp'); 96 mkdir($t->testdir() . '/dir sp');
93 97
94 $t->run()->plan(18); 98 $t->run()->plan(19);
95 99
96 ############################################################################### 100 ###############################################################################
97 101
98 my $p = port(8080); 102 my $p = port(8080);
99 103
157 161
158 } 162 }
159 163
160 like(get('off', '/return301'), qr!Location: /redirect\x0d?$!m, 'off return'); 164 like(get('off', '/return301'), qr!Location: /redirect\x0d?$!m, 'off return');
161 165
166 # per RFC 3986, these charaters are not allowed unescaped:
167 # %00-%1F, %7F-%FF, " ", """, "<", ">", "\", "^", "`", "{", "|", "}"
168 # additionally, all characters in ESCAPE_URI: "?", "%", "#"
169
170 TODO: {
171 local $TODO = 'not yet' unless $t->has_version('1.21.1');
172
173 like(get('off', '/auto%20%22%23%25%3C%3E%3F%5C%5E%60%7B%7C%7D'),
174 qr!Location: /auto%20%22%23%25%3C%3E%3F%5C%5E%60%7B%7C%7D/\x0d?$!m,
175 'auto escaped strict');
176
177 }
178
162 ############################################################################### 179 ###############################################################################
163 180
164 sub get { 181 sub get {
165 my ($host, $uri) = @_; 182 my ($host, $uri) = @_;
166 http(<<EOF); 183 http(<<EOF);