Mercurial > hg > nginx-tests
comparison subrequest_output_buffer_size.t @ 1294:192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Thu, 01 Mar 2018 19:30:44 +0300 |
parents | |
children | 22a8982d5de6 |
comparison
equal
deleted
inserted
replaced
1293:4442767118e0 | 1294:192a44f590a9 |
---|---|
1 #!/usr/bin/perl | |
2 | |
3 # (C) Sergey Kandaurov | |
4 # (C) Nginx, Inc. | |
5 | |
6 # Tests for subrequest_output_buffer_size directive. | |
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 proxy ssi/) | |
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 server { | |
39 listen 127.0.0.1:8080; | |
40 server_name localhost; | |
41 | |
42 location / { | |
43 proxy_pass http://127.0.0.1:8081; | |
44 } | |
45 | |
46 location /longok { | |
47 proxy_pass http://127.0.0.1:8081/long; | |
48 subrequest_output_buffer_size 42k; | |
49 } | |
50 | |
51 location /ssi { | |
52 ssi on; | |
53 } | |
54 } | |
55 | |
56 server { | |
57 listen 127.0.0.1:8081; | |
58 server_name localhost; | |
59 | |
60 location / { } | |
61 } | |
62 } | |
63 | |
64 EOF | |
65 | |
66 $t->write_file('ssi.html', | |
67 '<!--#include virtual="/$arg_c" set="x" -->' . | |
68 'set: <!--#echo var="x" -->'); | |
69 | |
70 $t->write_file('length', 'TEST-OK-IF-YOU-SEE-THIS'); | |
71 $t->write_file('long', 'x' x 40000); | |
72 $t->write_file('empty', ''); | |
73 | |
74 $t->try_run('no subrequest_output_buffer_size')->plan(4); | |
75 | |
76 ############################################################################### | |
77 | |
78 my ($r, $n); | |
79 | |
80 like(http_get('/ssi.html?c=length'), qr/SEE-THIS/, 'request'); | |
81 like(http_get('/ssi.html?c=empty'), qr/200 OK/, 'empty'); | |
82 unlike(http_get('/ssi.html?c=long'), qr/200 OK/, 'long default'); | |
83 like(http_get('/ssi.html?c=longok'), qr/200 OK/, 'long ok'); | |
84 | |
85 ############################################################################### |