Mercurial > hg > nginx-tests
annotate post_action.t @ 1974:b5036a0f9ae0 default tip
Tests: improved compatibility when using recent "openssl" app.
Starting with OpenSSL 3.0, "openssl genrsa" generates encrypted keys
in PKCS#8 format instead of previously used PKCS#1 format. Further,
since OpenSSL 1.1.0 such keys are using PBKDF2 hmacWithSHA256.
Such keys are not supported by old SSL libraries, notably by OpenSSL
before 1.0.0 (OpenSSL 0.9.8 only supports hmacWithSHA1) and by BoringSSL
before May 21, 2019 (support for hmacWithSHA256 was added in 302a4dee6c),
and trying to load such keys into nginx compiled with an old SSL library
results in "unsupported prf" errors.
To facilitate testing with old SSL libraries, keys are now generated
with "openssl genrsa -traditional" if the flag is available.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 06 May 2024 00:04:26 +0300 |
parents | 882267679006 |
children |
rev | line source |
---|---|
453 | 1 #!/usr/bin/perl |
2 | |
3 # (C) Maxim Dounin | |
4 # (C) Nginx, Inc. | |
5 | |
6 # Tests for nginx post_action directive. | |
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 | |
593
6c0a5903d0ae
Tests: cleanup now duplicating tests for no alerts.
Sergey Kandaurov <pluknet@nginx.com>
parents:
548
diff
changeset
|
25 my $t = Test::Nginx->new()->has(qw/http proxy/)->plan(5); |
453 | 26 |
27 $t->write_file_expand('nginx.conf', <<'EOF'); | |
28 | |
29 %%TEST_GLOBALS%% | |
30 | |
31 daemon off; | |
32 | |
33 events { | |
34 } | |
35 | |
36 http { | |
37 %%TEST_GLOBALS_HTTP%% | |
38 | |
39 server { | |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
40 listen 127.0.0.1:8080; |
453 | 41 server_name localhost; |
42 | |
43 location / { | |
44 post_action /post.html; | |
45 } | |
46 | |
47 location /post.html { | |
48 # static | |
49 } | |
50 | |
51 location /remote { | |
52 post_action /post.remote; | |
53 } | |
54 | |
55 location /post.remote { | |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
56 proxy_pass http://127.0.0.1:8080/post.html; |
453 | 57 } |
58 } | |
59 } | |
60 | |
61 EOF | |
62 | |
63 $t->write_file('index.html', 'SEE-THIS'); | |
64 $t->write_file('post.html', 'HIDDEN'); | |
65 $t->write_file('remote', 'SEE-THIS'); | |
66 | |
67 $t->run(); | |
68 | |
69 ############################################################################### | |
70 | |
71 like(http_get('/'), qr/SEE-THIS/m, 'post action'); | |
72 unlike(http_get('/'), qr/HIDDEN/m, 'no additional body'); | |
73 | |
74 like(http_get('/remote'), qr/SEE-THIS/m, 'post action proxy'); | |
75 unlike(http_get('/remote'), qr/HIDDEN/m, 'no additional body proxy'); | |
76 | |
77 $t->stop(); | |
78 | |
79 like(`cat ${\($t->testdir())}/access.log`, qr/post/, 'post action in logs'); | |
80 | |
81 ############################################################################### |