Mercurial > hg > nginx-tests
changeset 900:257de77879e8
Tests: added access_log test with binary data.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Mon, 18 Apr 2016 13:56:35 +0300 |
parents | c0c2fc0e7208 |
children | 25bf03642a45 |
files | access_log.t |
diffstat | 1 files changed, 12 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/access_log.t Mon Apr 18 13:56:13 2016 +0300 +++ b/access_log.t Mon Apr 18 13:56:35 2016 +0300 @@ -21,7 +21,7 @@ select STDERR; $| = 1; select STDOUT; $| = 1; -my $t = Test::Nginx->new()->has(qw/http rewrite/)->plan(9) +my $t = Test::Nginx->new()->has(qw/http rewrite/)->plan(10) ->write_file_expand('nginx.conf', <<'EOF'); %%TEST_GLOBALS%% @@ -35,6 +35,7 @@ %%TEST_GLOBALS_HTTP%% log_format test "$uri:$status"; + log_format binary $binary_remote_addr; server { listen 127.0.0.1:8080; @@ -86,6 +87,10 @@ access_log %%TESTDIR%%/varlog_${arg_logname} test; return 200 OK; } + + location /binary { + access_log %%TESTDIR%%/binary.log binary; + } } } @@ -127,6 +132,8 @@ http_get('/varlog?logname=0'); http_get('/varlog?logname=filename'); +http_get('/binary'); + # wait for file to appear with nonzero size thanks to the flush parameter for (1 .. 10) { @@ -198,4 +205,8 @@ is($t->read_file('varlog_0'), "/varlog:200\n", 'varlog literal zero name'); is($t->read_file('varlog_filename'), "/varlog:200\n", 'varlog good name'); +# binary data is escaped + +is($t->read_file('binary.log'), "\\x7F\\x00\\x00\\x01\n", 'binary'); + ###############################################################################