annotate merge_slashes.t @ 1585:bff287fbf347

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