comparison access_log_none.t @ 1296:5d75938b2622

Tests: basic access_log tests with log_format 'escape=none'.
author Sergey Kandaurov <pluknet@nginx.com>
date Fri, 02 Mar 2018 19:16:54 +0300
parents
children 97c8280de681
comparison
equal deleted inserted replaced
1295:22a8982d5de6 1296:5d75938b2622
1 #!/usr/bin/perl
2
3 # (C) Sergey Kandaurov
4 # (C) Nginx, Inc.
5
6 # Tests for access_log with escape parameter.
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
25 my $t = Test::Nginx->new()->has(qw/http/)
26 ->write_file_expand('nginx.conf', <<'EOF');
27
28 %%TEST_GLOBALS%%
29
30 daemon off;
31
32 events {
33 }
34
35 http {
36 %%TEST_GLOBALS_HTTP%%
37
38 log_format none escape=none $arg_a$arg_b$arg_c;
39
40 server {
41 listen 127.0.0.1:8080;
42 server_name localhost;
43
44 access_log %%TESTDIR%%/none.log none;
45 }
46 }
47
48 EOF
49
50 $t->try_run('no escape=none')->plan(1);
51
52 ###############################################################################
53
54 http_get('/?a="1 \\ ' . pack("n", 0x1b1c) . ' "&c=2');
55
56 $t->stop();
57
58 is($t->read_file('none.log'), '"1 \\ ' . pack("n", 0x1b1c) . " \"2\n", 'none');
59
60 ###############################################################################