Mercurial > hg > nginx-tests
annotate stream_access_log_none.t @ 1606:e4e0695552ed
Tests: fixed stream_proxy_ssl_conf_command.t.
The stream_proxy_ssl_conf_command.t test used stream return module
to return the response. Since this ignores actual request, but the
perl test code used http_get(). This might result in the request being
sent after the response is returned and the connection closed by the server,
resulting in RST being generated and no response seen by the client at all.
Fix is to use "stream(...)->read()" instead of http_get(), so
no request is sent at all, eliminating possibility of RST being
generated.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Tue, 10 Nov 2020 05:03:29 +0300 |
parents | 97c8280de681 |
children | f3ba4c74de31 |
rev | line source |
---|---|
1296
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
1 #!/usr/bin/perl |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
2 |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
3 # (C) Sergey Kandaurov |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
4 # (C) Nginx, Inc. |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
5 |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
6 # Stream tests for access_log with escape parameter. |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
7 |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
8 ############################################################################### |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
9 |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
10 use warnings; |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
11 use strict; |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
12 |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
13 use Test::More; |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
14 |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
15 BEGIN { use FindBin; chdir($FindBin::Bin); } |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
16 |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
17 use lib 'lib'; |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
18 use Test::Nginx; |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
19 |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
20 ############################################################################### |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
21 |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
22 select STDERR; $| = 1; |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
23 select STDOUT; $| = 1; |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
24 |
1381
97c8280de681
Tests: removed TODO and try_run() checks for legacy versions.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1296
diff
changeset
|
25 my $t = Test::Nginx->new()->has(qw/stream stream_map stream_return/)->plan(1) |
1296
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
26 ->write_file_expand('nginx.conf', <<'EOF'); |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
27 |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
28 %%TEST_GLOBALS%% |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
29 |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
30 daemon off; |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
31 |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
32 events { |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
33 } |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
34 |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
35 stream { |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
36 map $pid $a { |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
37 default '" \ "'; |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
38 } |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
39 map $pid $b { |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
40 default "foo"; |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
41 } |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
42 |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
43 log_format none escape=none $a$b$upstream_addr; |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
44 |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
45 server { |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
46 listen 127.0.0.1:8080; |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
47 return ok; |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
48 |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
49 access_log %%TESTDIR%%/none.log none; |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
50 } |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
51 } |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
52 |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
53 EOF |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
54 |
1381
97c8280de681
Tests: removed TODO and try_run() checks for legacy versions.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1296
diff
changeset
|
55 $t->run(); |
1296
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
56 |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
57 ############################################################################### |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
58 |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
59 http_get('/'); |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
60 |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
61 $t->stop(); |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
62 |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
63 is($t->read_file('none.log'), '" \\ "foo' . "\n", 'none'); |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
64 |
5d75938b2622
Tests: basic access_log tests with log_format 'escape=none'.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
65 ############################################################################### |