comparison addition_buffered.t @ 1056:1e41a0de0772

Tests: various last_buf tests.
author Sergey Kandaurov <pluknet@nginx.com>
date Wed, 12 Oct 2016 17:49:03 +0300
parents
children 8c5ba361b416
comparison
equal deleted inserted replaced
1055:8979f0d86c29 1056:1e41a0de0772
1 #!/usr/bin/perl
2
3 # (C) Sergey Kandaurov
4 # (C) Nginx, Inc.
5
6 # Tests for addition module with buffered data from other filters.
7
8 # In particular, sub filter may have a partial match buffered.
9
10 ###############################################################################
11
12 use warnings;
13 use strict;
14
15 use Test::More;
16
17 BEGIN { use FindBin; chdir($FindBin::Bin); }
18
19 use lib 'lib';
20 use Test::Nginx;
21
22 ###############################################################################
23
24 select STDERR; $| = 1;
25 select STDOUT; $| = 1;
26
27 my $t = Test::Nginx->new()->has(qw/http proxy sub addition/)->plan(1);
28
29 $t->write_file_expand('nginx.conf', <<'EOF');
30
31 %%TEST_GLOBALS%%
32
33 daemon off;
34
35 events {
36 }
37
38 http {
39 %%TEST_GLOBALS_HTTP%%
40
41 server {
42 listen 127.0.0.1:8080;
43 server_name localhost;
44
45 location / { }
46 location /proxy/ {
47 sub_filter foo bar;
48 add_after_body /after.html;
49 proxy_pass http://127.0.0.1:8080/;
50 }
51 }
52 }
53
54 EOF
55
56 $t->write_file('after.html', 'after');
57 $t->write_file('body.html', 'XXXXX');
58
59 $t->run();
60
61 ###############################################################################
62
63 # if data is buffered, there should be no interleaved data in output
64
65 TODO: {
66 local $TODO = 'not yet' unless $t->has_version('1.11.5');
67
68 like(http_get('/proxy/body.html'), qr/^XXXXXafter$/m, 'request');
69
70 }
71
72 ###############################################################################