Mercurial > hg > nginx-tests
annotate http_uri.t @ 1542:451e787aad76
Tests: reworked libgd version detection.
The "libgd-config" binary is deprecated in recent versions and may not exist
or have unexpected output. More, it may not present within older versions,
as well, if installed separately, which previously broke test assumptions.
The fix is change the fallback to skip tests. In addition, recent Perl GD
module (2.57) started to export libgd version, which is now also consulted.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Mon, 13 Jan 2020 18:15:35 +0300 |
parents | eb33558f731d |
children | 7b80c8e0479a |
rev | line source |
---|---|
1515
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
1 #!/usr/bin/perl |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
2 |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
3 # (C) Sergey Kandaurov |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
4 # (C) Nginx, Inc. |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
5 |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
6 # Tests for URI normalization. |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
7 |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
8 ############################################################################### |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
9 |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
10 use warnings; |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
11 use strict; |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
12 |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
13 use Test::More; |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
14 |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
15 BEGIN { use FindBin; chdir($FindBin::Bin); } |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
16 |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
17 use lib 'lib'; |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
18 use Test::Nginx; |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
19 |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
20 ############################################################################### |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
21 |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
22 select STDERR; $| = 1; |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
23 select STDOUT; $| = 1; |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
24 |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
25 my $t = Test::Nginx->new()->has(qw/http rewrite/)->plan(8) |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
26 ->write_file_expand('nginx.conf', <<'EOF')->run(); |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
27 |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
28 %%TEST_GLOBALS%% |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
29 |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
30 daemon off; |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
31 |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
32 events { |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
33 } |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
34 |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
35 http { |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
36 %%TEST_GLOBALS_HTTP%% |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
37 |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
38 server { |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
39 listen 127.0.0.1:8080; |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
40 server_name localhost; |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
41 |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
42 location / { |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
43 add_header X-URI "x $uri x"; |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
44 return 204; |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
45 } |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
46 } |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
47 } |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
48 |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
49 EOF |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
50 |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
51 ############################################################################### |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
52 |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
53 local $TODO = 'not yet' unless $t->has_version('1.17.5'); |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
54 |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
55 like(http_get('/foo/bar%'), qr/400 Bad/, 'percent'); |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
56 like(http_get('/foo/bar%1'), qr/400 Bad/, 'percent digit'); |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
57 |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
58 like(http_get('/foo/bar/.?args'), qr!x /foo/bar/ x!, 'dot args'); |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
59 like(http_get('/foo/bar/.#frag'), qr!x /foo/bar/ x!, 'dot frag'); |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
60 like(http_get('/foo/bar/..?args'), qr!x /foo/ x!, 'dot dot args'); |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
61 like(http_get('/foo/bar/..#frag'), qr!x /foo/ x!, 'dot dot frag'); |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
62 like(http_get('/foo/bar/.'), qr!x /foo/bar/ x!, 'trailing dot'); |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
63 like(http_get('/foo/bar/..'), qr!x /foo/ x!, 'trailing dot dot'); |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
64 |
eb33558f731d
Tests: URI normalization tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
65 ############################################################################### |