Mercurial > hg > nginx-tests
annotate http_uri.t @ 1619:436d0ffc2ea3
Tests: correctly shutdown ssl for reproducible session reuse tests.
Previously, session reuse tests in stream_ssl_certificate.t were prone
to testing errors, since the client doesn't write any application data
before closing a connection, which is done so to pass tests on win32.
In this case, the server may happened to get an unexpected eof meaning
that it will abandon that session. This is specific to stream testing
pattern, changes to ssl_certificate.t are applied too for consistency.
This is also specific to SSL_R_UNEXPECTED_EOF_WHILE_READING, which is
implemented in OpenSSL 3.0.0.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Mon, 23 Nov 2020 22:46:06 +0000 |
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 ############################################################################### |