Mercurial > hg > nginx-tests
annotate post_action.t @ 1965:84f4d4930835
Tests: relaxed mail_imap_ssl.t cipher matching.
Previously, exact match between cipher name in the log and the one from
IO::Socket:SSL was needed, which might not be the case if nginx and
Net::SSLeay are compiled with different SSL libraries, notably LibreSSL
(which uses names like AEAD-AES256-GCM-SHA384 till 3.5.0), and
OpenSSL or BoringSSL (which use TLS_AES_256_GCM_SHA384). In particular,
this affects macOS, where Net::SSLeay compiled with LibreSSL 3.3.6 is
shipped with the OS, while nginx is likely to be compiled with OpenSSL.
Fix is to not require exact match but instead accept properly looking names
as checked by a regular expression, similarly to how it is already tested
in ssl.t and stream_ssl_variables.t.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 06 May 2024 00:01:40 +0300 |
parents | 882267679006 |
children | d329b05e20fa |
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 ############################################################################### |