comparison merge_slashes.t @ 1516:420aaeb40c09

Tests: merge_slashes tests.
author Sergey Kandaurov <pluknet@nginx.com>
date Wed, 09 Oct 2019 16:46:03 +0300
parents
children 5ac6efbe5552
comparison
equal deleted inserted replaced
1515:eb33558f731d 1516:420aaeb40c09
1 #!/usr/bin/perl
2
3 # (C) Sergey Kandaurov
4 # (C) Nginx, Inc.
5
6 # Tests for URI normalization, merge_slashes off.
7
8 ###############################################################################
9
10 use warnings;
11 use strict;
12
13 use Test::More;
14
15 BEGIN { use FindBin; chdir($FindBin::Bin); }
16
17 use lib 'lib';
18 use Test::Nginx;
19
20 ###############################################################################
21
22 select STDERR; $| = 1;
23 select STDOUT; $| = 1;
24
25 my $t = Test::Nginx->new()->has(qw/http rewrite/)->plan(2)
26 ->write_file_expand('nginx.conf', <<'EOF')->run();
27
28 %%TEST_GLOBALS%%
29
30 daemon off;
31
32 events {
33 }
34
35 http {
36 %%TEST_GLOBALS_HTTP%%
37
38 server {
39 listen 127.0.0.1:8080;
40 server_name localhost;
41
42 merge_slashes off;
43
44 location / {
45 add_header X-URI "x $uri x";
46 return 204;
47 }
48 }
49 }
50
51 EOF
52
53 ###############################################################################
54
55 local $TODO = 'not yet' unless $t->has_version('1.17.5');
56
57 like(http_get('/foo//../bar'), qr!x /foo/bar x!, 'merge slashes');
58 like(http_get('/foo///../bar'), qr!x /foo//bar x!, 'merge slashes 2');
59
60 ###############################################################################