Mercurial > hg > nginx-tests
annotate access_log.t @ 1990:85d88cd5091c
Tests: SSI include stub tests.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Thu, 04 Jul 2024 17:42:55 +0300 |
parents | 0e1865aa9b33 |
children |
rev | line source |
---|---|
394
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1 #!/usr/bin/perl |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
2 |
1385
5eb82b417fd6
Tests: access_log escape tests merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1217
diff
changeset
|
3 # (C) Sergey Kandaurov |
394
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
4 # (C) Nginx, Inc. |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
5 |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
6 # Tests for access_log. |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
7 |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
8 ############################################################################### |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
9 |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
10 use warnings; |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
11 use strict; |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
12 |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
13 use Test::More; |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
14 |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
15 BEGIN { use FindBin; chdir($FindBin::Bin); } |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
16 |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
17 use lib 'lib'; |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
18 use Test::Nginx; |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
19 |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
20 ############################################################################### |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
21 |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
22 select STDERR; $| = 1; |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
23 select STDOUT; $| = 1; |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
24 |
1669
03cf423ea140
Tests: added access_log test with server/client address variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1385
diff
changeset
|
25 my $t = Test::Nginx->new()->has(qw/http rewrite gzip/)->plan(19) |
394
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
26 ->write_file_expand('nginx.conf', <<'EOF'); |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
27 |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
28 %%TEST_GLOBALS%% |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
29 |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
30 daemon off; |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
31 |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
32 events { |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
33 } |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
34 |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
35 http { |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
36 %%TEST_GLOBALS_HTTP%% |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
37 |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
38 log_format test "$uri:$status"; |
1188
074e05b33b1a
Tests: added access_log test with long line in log_format.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1175
diff
changeset
|
39 log_format long "long line $uri:$status"; |
1669
03cf423ea140
Tests: added access_log test with server/client address variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1385
diff
changeset
|
40 log_format addr "$remote_addr:$remote_port:$server_addr:$server_port"; |
900
257de77879e8
Tests: added access_log test with binary data.
Sergey Kandaurov <pluknet@nginx.com>
parents:
899
diff
changeset
|
41 log_format binary $binary_remote_addr; |
394
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
42 |
1708
7d133fc4619d
Tests: adjusted access_log escaping tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1669
diff
changeset
|
43 log_format default escape=default $uri$arg_b$arg_c; |
7d133fc4619d
Tests: adjusted access_log escaping tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1669
diff
changeset
|
44 log_format none escape=none $uri$arg_b$arg_c; |
7d133fc4619d
Tests: adjusted access_log escaping tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1669
diff
changeset
|
45 log_format json escape=json $uri$arg_b$arg_c; |
1385
5eb82b417fd6
Tests: access_log escape tests merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1217
diff
changeset
|
46 |
394
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
47 server { |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
48 listen 127.0.0.1:8080; |
394
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
49 server_name localhost; |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
50 |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
51 location /combined { |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
52 access_log %%TESTDIR%%/combined.log; |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
53 return 200 OK; |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
54 |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
55 location /combined/off { |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
56 access_log off; |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
57 return 200 OK; |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
58 } |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
59 } |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
60 |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
61 location /filtered { |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
62 access_log %%TESTDIR%%/filtered.log test |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
63 if=$arg_logme; |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
64 return 200 OK; |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
65 } |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
66 |
463
da1a459c9318
Tests: access_log "if=" tests with buffering.
Sergey Kandaurov <pluknet@nginx.com>
parents:
458
diff
changeset
|
67 location /filtered/complex { |
394
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
68 access_log %%TESTDIR%%/complex.log test |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
69 if=$arg_logme$arg_logmetoo; |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
70 return 200 OK; |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
71 } |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
72 |
463
da1a459c9318
Tests: access_log "if=" tests with buffering.
Sergey Kandaurov <pluknet@nginx.com>
parents:
458
diff
changeset
|
73 location /filtered/noreuse { |
da1a459c9318
Tests: access_log "if=" tests with buffering.
Sergey Kandaurov <pluknet@nginx.com>
parents:
458
diff
changeset
|
74 access_log %%TESTDIR%%/noreuse.log test buffer=16k |
da1a459c9318
Tests: access_log "if=" tests with buffering.
Sergey Kandaurov <pluknet@nginx.com>
parents:
458
diff
changeset
|
75 if=$arg_a; |
da1a459c9318
Tests: access_log "if=" tests with buffering.
Sergey Kandaurov <pluknet@nginx.com>
parents:
458
diff
changeset
|
76 access_log %%TESTDIR%%/noreuse.log test buffer=16k |
da1a459c9318
Tests: access_log "if=" tests with buffering.
Sergey Kandaurov <pluknet@nginx.com>
parents:
458
diff
changeset
|
77 if=$arg_b; |
da1a459c9318
Tests: access_log "if=" tests with buffering.
Sergey Kandaurov <pluknet@nginx.com>
parents:
458
diff
changeset
|
78 return 200 OK; |
da1a459c9318
Tests: access_log "if=" tests with buffering.
Sergey Kandaurov <pluknet@nginx.com>
parents:
458
diff
changeset
|
79 } |
da1a459c9318
Tests: access_log "if=" tests with buffering.
Sergey Kandaurov <pluknet@nginx.com>
parents:
458
diff
changeset
|
80 |
394
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
81 location /compressed { |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
82 access_log %%TESTDIR%%/compressed.log test |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
83 gzip buffer=1m flush=100ms; |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
84 return 200 OK; |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
85 } |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
86 |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
87 location /multi { |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
88 access_log %%TESTDIR%%/multi1.log test; |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
89 access_log %%TESTDIR%%/multi2.log test; |
1188
074e05b33b1a
Tests: added access_log test with long line in log_format.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1175
diff
changeset
|
90 access_log %%TESTDIR%%/long.log long; |
394
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
91 return 200 OK; |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
92 } |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
93 |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
94 location /varlog { |
616
e9f48f1e905b
Tests: avoid alert/crit error logs in access_log.t.
Sergey Kandaurov <pluknet@nginx.com>
parents:
568
diff
changeset
|
95 access_log %%TESTDIR%%/varlog_${arg_logname} test; |
394
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
96 return 200 OK; |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
97 } |
900
257de77879e8
Tests: added access_log test with binary data.
Sergey Kandaurov <pluknet@nginx.com>
parents:
899
diff
changeset
|
98 |
1189
1c703303feee
Tests: basic open_log_file_cache log module tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1188
diff
changeset
|
99 location /cache { |
1c703303feee
Tests: basic open_log_file_cache log module tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1188
diff
changeset
|
100 open_log_file_cache max=3 inactive=20s valid=1m min_uses=2; |
1c703303feee
Tests: basic open_log_file_cache log module tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1188
diff
changeset
|
101 access_log %%TESTDIR%%/dir/cache_${arg_logname} test; |
1c703303feee
Tests: basic open_log_file_cache log module tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1188
diff
changeset
|
102 return 200 OK; |
1c703303feee
Tests: basic open_log_file_cache log module tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1188
diff
changeset
|
103 } |
1c703303feee
Tests: basic open_log_file_cache log module tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1188
diff
changeset
|
104 |
1669
03cf423ea140
Tests: added access_log test with server/client address variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1385
diff
changeset
|
105 location /addr { |
03cf423ea140
Tests: added access_log test with server/client address variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1385
diff
changeset
|
106 access_log %%TESTDIR%%/addr.log addr; |
03cf423ea140
Tests: added access_log test with server/client address variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1385
diff
changeset
|
107 } |
03cf423ea140
Tests: added access_log test with server/client address variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1385
diff
changeset
|
108 |
900
257de77879e8
Tests: added access_log test with binary data.
Sergey Kandaurov <pluknet@nginx.com>
parents:
899
diff
changeset
|
109 location /binary { |
257de77879e8
Tests: added access_log test with binary data.
Sergey Kandaurov <pluknet@nginx.com>
parents:
899
diff
changeset
|
110 access_log %%TESTDIR%%/binary.log binary; |
257de77879e8
Tests: added access_log test with binary data.
Sergey Kandaurov <pluknet@nginx.com>
parents:
899
diff
changeset
|
111 } |
1385
5eb82b417fd6
Tests: access_log escape tests merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1217
diff
changeset
|
112 |
5eb82b417fd6
Tests: access_log escape tests merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1217
diff
changeset
|
113 location /escape { |
5eb82b417fd6
Tests: access_log escape tests merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1217
diff
changeset
|
114 access_log %%TESTDIR%%/test.log default; |
5eb82b417fd6
Tests: access_log escape tests merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1217
diff
changeset
|
115 access_log %%TESTDIR%%/none.log none; |
5eb82b417fd6
Tests: access_log escape tests merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1217
diff
changeset
|
116 access_log %%TESTDIR%%/json.log json; |
5eb82b417fd6
Tests: access_log escape tests merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1217
diff
changeset
|
117 } |
394
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
118 } |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
119 } |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
120 |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
121 EOF |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
122 |
1217
7df2265e61be
Tests: made access_log.t pass under root user again (closes #1379).
Sergey Kandaurov <pluknet@nginx.com>
parents:
1191
diff
changeset
|
123 my $d = $t->testdir(); |
7df2265e61be
Tests: made access_log.t pass under root user again (closes #1379).
Sergey Kandaurov <pluknet@nginx.com>
parents:
1191
diff
changeset
|
124 |
7df2265e61be
Tests: made access_log.t pass under root user again (closes #1379).
Sergey Kandaurov <pluknet@nginx.com>
parents:
1191
diff
changeset
|
125 mkdir "$d/dir"; |
7df2265e61be
Tests: made access_log.t pass under root user again (closes #1379).
Sergey Kandaurov <pluknet@nginx.com>
parents:
1191
diff
changeset
|
126 |
568
907e89fba9c3
Tests: removed TODO and try_run() checks for legacy versions.
Sergey Kandaurov <pluknet@nginx.com>
parents:
467
diff
changeset
|
127 $t->run(); |
394
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
128 |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
129 ############################################################################### |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
130 |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
131 http_get('/combined'); |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
132 http_get('/combined/off'); |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
133 |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
134 http_get('/filtered'); |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
135 http_get('/filtered/empty?logme='); |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
136 http_get('/filtered/zero?logme=0'); |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
137 http_get('/filtered/good?logme=1'); |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
138 http_get('/filtered/work?logme=yes'); |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
139 |
463
da1a459c9318
Tests: access_log "if=" tests with buffering.
Sergey Kandaurov <pluknet@nginx.com>
parents:
458
diff
changeset
|
140 http_get('/filtered/complex'); |
da1a459c9318
Tests: access_log "if=" tests with buffering.
Sergey Kandaurov <pluknet@nginx.com>
parents:
458
diff
changeset
|
141 http_get('/filtered/complex/one?logme=1'); |
da1a459c9318
Tests: access_log "if=" tests with buffering.
Sergey Kandaurov <pluknet@nginx.com>
parents:
458
diff
changeset
|
142 http_get('/filtered/complex/two?logmetoo=1'); |
da1a459c9318
Tests: access_log "if=" tests with buffering.
Sergey Kandaurov <pluknet@nginx.com>
parents:
458
diff
changeset
|
143 http_get('/filtered/complex/either1?logme=A&logmetoo=B'); |
da1a459c9318
Tests: access_log "if=" tests with buffering.
Sergey Kandaurov <pluknet@nginx.com>
parents:
458
diff
changeset
|
144 http_get('/filtered/complex/either2?logme=A'); |
da1a459c9318
Tests: access_log "if=" tests with buffering.
Sergey Kandaurov <pluknet@nginx.com>
parents:
458
diff
changeset
|
145 http_get('/filtered/complex/either3?logmetoo=B'); |
da1a459c9318
Tests: access_log "if=" tests with buffering.
Sergey Kandaurov <pluknet@nginx.com>
parents:
458
diff
changeset
|
146 http_get('/filtered/complex/either4?logme=0&logmetoo=0'); |
da1a459c9318
Tests: access_log "if=" tests with buffering.
Sergey Kandaurov <pluknet@nginx.com>
parents:
458
diff
changeset
|
147 http_get('/filtered/complex/neither?logme=&logmetoo='); |
da1a459c9318
Tests: access_log "if=" tests with buffering.
Sergey Kandaurov <pluknet@nginx.com>
parents:
458
diff
changeset
|
148 |
da1a459c9318
Tests: access_log "if=" tests with buffering.
Sergey Kandaurov <pluknet@nginx.com>
parents:
458
diff
changeset
|
149 http_get('/filtered/noreuse1/zero?a=0'); |
da1a459c9318
Tests: access_log "if=" tests with buffering.
Sergey Kandaurov <pluknet@nginx.com>
parents:
458
diff
changeset
|
150 http_get('/filtered/noreuse1/good?a=1'); |
da1a459c9318
Tests: access_log "if=" tests with buffering.
Sergey Kandaurov <pluknet@nginx.com>
parents:
458
diff
changeset
|
151 http_get('/filtered/noreuse2/zero?b=0'); |
da1a459c9318
Tests: access_log "if=" tests with buffering.
Sergey Kandaurov <pluknet@nginx.com>
parents:
458
diff
changeset
|
152 http_get('/filtered/noreuse2/good?b=1'); |
394
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
153 |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
154 http_get('/compressed'); |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
155 |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
156 http_get('/multi'); |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
157 |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
158 http_get('/varlog'); |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
159 http_get('/varlog?logname='); |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
160 http_get('/varlog?logname=0'); |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
161 http_get('/varlog?logname=filename'); |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
162 |
1669
03cf423ea140
Tests: added access_log test with server/client address variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1385
diff
changeset
|
163 my $s = http('', start => 1); |
03cf423ea140
Tests: added access_log test with server/client address variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1385
diff
changeset
|
164 my $addr = $s->sockhost(); |
03cf423ea140
Tests: added access_log test with server/client address variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1385
diff
changeset
|
165 my $port = $s->sockport(); |
03cf423ea140
Tests: added access_log test with server/client address variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1385
diff
changeset
|
166 my $saddr = $s->peerhost(); |
03cf423ea140
Tests: added access_log test with server/client address variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1385
diff
changeset
|
167 my $sport = $s->peerport(); |
1865
0e1865aa9b33
Tests: reworked http SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1708
diff
changeset
|
168 http_get('/addr', socket => $s); |
1669
03cf423ea140
Tests: added access_log test with server/client address variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1385
diff
changeset
|
169 |
900
257de77879e8
Tests: added access_log test with binary data.
Sergey Kandaurov <pluknet@nginx.com>
parents:
899
diff
changeset
|
170 http_get('/binary'); |
257de77879e8
Tests: added access_log test with binary data.
Sergey Kandaurov <pluknet@nginx.com>
parents:
899
diff
changeset
|
171 |
1708
7d133fc4619d
Tests: adjusted access_log escaping tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1669
diff
changeset
|
172 # /escape/"1 %1B%1C "?c=2 |
7d133fc4619d
Tests: adjusted access_log escaping tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1669
diff
changeset
|
173 http_get('/escape/%221%20%1B%1C%20%22?c=2'); |
1385
5eb82b417fd6
Tests: access_log escape tests merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1217
diff
changeset
|
174 |
1189
1c703303feee
Tests: basic open_log_file_cache log module tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1188
diff
changeset
|
175 http_get('/cache?logname=lru'); |
1c703303feee
Tests: basic open_log_file_cache log module tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1188
diff
changeset
|
176 http_get('/cache?logname=lru'); |
1c703303feee
Tests: basic open_log_file_cache log module tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1188
diff
changeset
|
177 http_get('/cache?logname=once'); |
1c703303feee
Tests: basic open_log_file_cache log module tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1188
diff
changeset
|
178 http_get('/cache?logname=first'); |
1c703303feee
Tests: basic open_log_file_cache log module tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1188
diff
changeset
|
179 http_get('/cache?logname=first'); |
1c703303feee
Tests: basic open_log_file_cache log module tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1188
diff
changeset
|
180 http_get('/cache?logname=second'); |
1c703303feee
Tests: basic open_log_file_cache log module tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1188
diff
changeset
|
181 http_get('/cache?logname=second'); |
1c703303feee
Tests: basic open_log_file_cache log module tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1188
diff
changeset
|
182 |
1217
7df2265e61be
Tests: made access_log.t pass under root user again (closes #1379).
Sergey Kandaurov <pluknet@nginx.com>
parents:
1191
diff
changeset
|
183 rename "$d/dir", "$d/dir_moved"; |
1189
1c703303feee
Tests: basic open_log_file_cache log module tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1188
diff
changeset
|
184 |
1c703303feee
Tests: basic open_log_file_cache log module tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1188
diff
changeset
|
185 http_get('/cache?logname=lru'); |
1c703303feee
Tests: basic open_log_file_cache log module tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1188
diff
changeset
|
186 http_get('/cache?logname=once'); |
1c703303feee
Tests: basic open_log_file_cache log module tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1188
diff
changeset
|
187 http_get('/cache?logname=first'); |
1c703303feee
Tests: basic open_log_file_cache log module tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1188
diff
changeset
|
188 http_get('/cache?logname=second'); |
1c703303feee
Tests: basic open_log_file_cache log module tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1188
diff
changeset
|
189 |
1217
7df2265e61be
Tests: made access_log.t pass under root user again (closes #1379).
Sergey Kandaurov <pluknet@nginx.com>
parents:
1191
diff
changeset
|
190 rename "$d/dir_moved", "$d/dir"; |
1191
a9187b424a94
Tests: restored access mode in open_log_file_cache test earlier.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1189
diff
changeset
|
191 |
451
be98c162f8bc
Tests: adjusted access_log test timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
394
diff
changeset
|
192 # wait for file to appear with nonzero size thanks to the flush parameter |
be98c162f8bc
Tests: adjusted access_log test timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
394
diff
changeset
|
193 |
be98c162f8bc
Tests: adjusted access_log test timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
394
diff
changeset
|
194 for (1 .. 10) { |
1217
7df2265e61be
Tests: made access_log.t pass under root user again (closes #1379).
Sergey Kandaurov <pluknet@nginx.com>
parents:
1191
diff
changeset
|
195 last if -s "$d/compressed.log"; |
451
be98c162f8bc
Tests: adjusted access_log test timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
394
diff
changeset
|
196 select undef, undef, undef, 0.1; |
be98c162f8bc
Tests: adjusted access_log test timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
394
diff
changeset
|
197 } |
394
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
198 |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
199 # verify that "gzip" parameter turns on compression |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
200 |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
201 my $log; |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
202 |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
203 SKIP: { |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
204 eval { require IO::Uncompress::Gunzip; }; |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
205 skip("IO::Uncompress::Gunzip not installed", 1) if $@; |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
206 |
467
43e05ac6c23c
Tests: the read_file function added in Test::Nginx.
Sergey Kandaurov <pluknet@nginx.com>
parents:
463
diff
changeset
|
207 my $gzipped = $t->read_file('compressed.log'); |
394
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
208 IO::Uncompress::Gunzip::gunzip(\$gzipped => \$log); |
458
ae69f9bdba92
Tests: fixed access_log.t on win32.
Maxim Dounin <mdounin@mdounin.ru>
parents:
451
diff
changeset
|
209 like($log, qr!^/compressed:200!s, 'compressed log - flush time'); |
394
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
210 } |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
211 |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
212 # now verify all other logs |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
213 |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
214 $t->stop(); |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
215 |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
216 |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
217 # verify that by default, 'combined' format is used, 'off' disables logging |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
218 |
899 | 219 like($t->read_file('combined.log'), |
746
f75bc412e802
Tests: unbreak access_log tests in jails.
Sergey Kandaurov <pluknet@nginx.com>
parents:
616
diff
changeset
|
220 qr!^\Q$addr - - [\E .* |
394
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
221 \Q] "GET /combined HTTP/1.0" 200 2 "-" "-"\E$!x, |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
222 'default log format'); |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
223 |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
224 # verify that log filtering works |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
225 |
467
43e05ac6c23c
Tests: the read_file function added in Test::Nginx.
Sergey Kandaurov <pluknet@nginx.com>
parents:
463
diff
changeset
|
226 $log = $t->read_file('filtered.log'); |
394
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
227 is($log, "/filtered/good:200\n/filtered/work:200\n", 'log filtering'); |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
228 |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
229 # verify "if=" argument works with complex value |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
230 |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
231 my $exp_complex = <<'EOF'; |
463
da1a459c9318
Tests: access_log "if=" tests with buffering.
Sergey Kandaurov <pluknet@nginx.com>
parents:
458
diff
changeset
|
232 /filtered/complex/one:200 |
da1a459c9318
Tests: access_log "if=" tests with buffering.
Sergey Kandaurov <pluknet@nginx.com>
parents:
458
diff
changeset
|
233 /filtered/complex/two:200 |
da1a459c9318
Tests: access_log "if=" tests with buffering.
Sergey Kandaurov <pluknet@nginx.com>
parents:
458
diff
changeset
|
234 /filtered/complex/either1:200 |
da1a459c9318
Tests: access_log "if=" tests with buffering.
Sergey Kandaurov <pluknet@nginx.com>
parents:
458
diff
changeset
|
235 /filtered/complex/either2:200 |
da1a459c9318
Tests: access_log "if=" tests with buffering.
Sergey Kandaurov <pluknet@nginx.com>
parents:
458
diff
changeset
|
236 /filtered/complex/either3:200 |
da1a459c9318
Tests: access_log "if=" tests with buffering.
Sergey Kandaurov <pluknet@nginx.com>
parents:
458
diff
changeset
|
237 /filtered/complex/either4:200 |
394
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
238 EOF |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
239 |
899 | 240 is($t->read_file('complex.log'), $exp_complex, 'if with complex value'); |
394
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
241 |
463
da1a459c9318
Tests: access_log "if=" tests with buffering.
Sergey Kandaurov <pluknet@nginx.com>
parents:
458
diff
changeset
|
242 # buffer created with false "if" is not reused among multiple access_log |
da1a459c9318
Tests: access_log "if=" tests with buffering.
Sergey Kandaurov <pluknet@nginx.com>
parents:
458
diff
changeset
|
243 |
908
adf5671391ac
Tests: use read_file subroutine in several tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
900
diff
changeset
|
244 $log = $t->read_file('noreuse.log'); |
463
da1a459c9318
Tests: access_log "if=" tests with buffering.
Sergey Kandaurov <pluknet@nginx.com>
parents:
458
diff
changeset
|
245 is($log, "/filtered/noreuse1/good:200\n/filtered/noreuse2/good:200\n", |
da1a459c9318
Tests: access_log "if=" tests with buffering.
Sergey Kandaurov <pluknet@nginx.com>
parents:
458
diff
changeset
|
246 'log filtering with buffering'); |
da1a459c9318
Tests: access_log "if=" tests with buffering.
Sergey Kandaurov <pluknet@nginx.com>
parents:
458
diff
changeset
|
247 |
394
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
248 # multiple logs in a same location |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
249 |
899 | 250 is($t->read_file('multi1.log'), "/multi:200\n", 'multiple logs 1'); |
394
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
251 |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
252 # same content in the second log |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
253 |
899 | 254 is($t->read_file('multi2.log'), "/multi:200\n", 'multiple logs 2'); |
394
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
255 |
1188
074e05b33b1a
Tests: added access_log test with long line in log_format.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1175
diff
changeset
|
256 is($t->read_file('long.log'), "long line /multi:200\n", 'long line format'); |
074e05b33b1a
Tests: added access_log test with long line in log_format.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1175
diff
changeset
|
257 |
394
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
258 # test log destinations with variables |
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
259 |
899 | 260 is($t->read_file('varlog_0'), "/varlog:200\n", 'varlog literal zero name'); |
261 is($t->read_file('varlog_filename'), "/varlog:200\n", 'varlog good name'); | |
394
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
262 |
1669
03cf423ea140
Tests: added access_log test with server/client address variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1385
diff
changeset
|
263 is($t->read_file('addr.log'), "$addr:$port:$saddr:$sport\n", 'addr'); |
03cf423ea140
Tests: added access_log test with server/client address variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1385
diff
changeset
|
264 |
900
257de77879e8
Tests: added access_log test with binary data.
Sergey Kandaurov <pluknet@nginx.com>
parents:
899
diff
changeset
|
265 # binary data is escaped |
980
d10ec0f0bb6d
Tests: unbreak access_log tests in jails.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
266 # that's "\\x7F\\x00\\x00\\x01\n" in $binary_remote_addr for "127.0.0.1" |
900
257de77879e8
Tests: added access_log test with binary data.
Sergey Kandaurov <pluknet@nginx.com>
parents:
899
diff
changeset
|
267 |
980
d10ec0f0bb6d
Tests: unbreak access_log tests in jails.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
268 my $expected = join '', map { sprintf "\\x%02X", $_ } split /\./, $addr; |
d10ec0f0bb6d
Tests: unbreak access_log tests in jails.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
269 |
d10ec0f0bb6d
Tests: unbreak access_log tests in jails.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
270 is($t->read_file('binary.log'), "$expected\n", 'binary'); |
900
257de77879e8
Tests: added access_log test with binary data.
Sergey Kandaurov <pluknet@nginx.com>
parents:
899
diff
changeset
|
271 |
1385
5eb82b417fd6
Tests: access_log escape tests merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1217
diff
changeset
|
272 # characters escaping |
5eb82b417fd6
Tests: access_log escape tests merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1217
diff
changeset
|
273 |
5eb82b417fd6
Tests: access_log escape tests merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1217
diff
changeset
|
274 is($t->read_file('test.log'), |
1708
7d133fc4619d
Tests: adjusted access_log escaping tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1669
diff
changeset
|
275 '/escape/\x221 \x1B\x1C \x22-2' . "\n", 'escape - default'); |
1385
5eb82b417fd6
Tests: access_log escape tests merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1217
diff
changeset
|
276 is($t->read_file('none.log'), |
1708
7d133fc4619d
Tests: adjusted access_log escaping tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1669
diff
changeset
|
277 "/escape/\"1 \x1B\x1C \"2\n", 'escape - none'); |
1385
5eb82b417fd6
Tests: access_log escape tests merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1217
diff
changeset
|
278 is($t->read_file('json.log'), |
1708
7d133fc4619d
Tests: adjusted access_log escaping tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1669
diff
changeset
|
279 '/escape/\"1 \u001B\u001C \"2' . "\n", 'escape - json'); |
1385
5eb82b417fd6
Tests: access_log escape tests merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1217
diff
changeset
|
280 |
1189
1c703303feee
Tests: basic open_log_file_cache log module tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1188
diff
changeset
|
281 SKIP: { |
1c703303feee
Tests: basic open_log_file_cache log module tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1188
diff
changeset
|
282 skip 'win32', 4 if $^O eq 'MSWin32'; |
1c703303feee
Tests: basic open_log_file_cache log module tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1188
diff
changeset
|
283 |
1c703303feee
Tests: basic open_log_file_cache log module tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1188
diff
changeset
|
284 is(@{[$t->read_file('/dir/cache_lru') =~ /\//g]}, 2, 'cache - closed lru'); |
1c703303feee
Tests: basic open_log_file_cache log module tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1188
diff
changeset
|
285 is(@{[$t->read_file('/dir/cache_once') =~ /\//g]}, 1, 'cache - min_uses'); |
1c703303feee
Tests: basic open_log_file_cache log module tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1188
diff
changeset
|
286 is(@{[$t->read_file('/dir/cache_first') =~ /\//g]}, 3, 'cache - cached 1'); |
1c703303feee
Tests: basic open_log_file_cache log module tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1188
diff
changeset
|
287 is(@{[$t->read_file('/dir/cache_second') =~ /\//g]}, 3, 'cache - cached 2'); |
1c703303feee
Tests: basic open_log_file_cache log module tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1188
diff
changeset
|
288 |
1c703303feee
Tests: basic open_log_file_cache log module tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1188
diff
changeset
|
289 } |
1c703303feee
Tests: basic open_log_file_cache log module tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1188
diff
changeset
|
290 |
394
8d436291c09b
Tests: added tests for the "access_log" directive.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
291 ############################################################################### |