Mercurial > hg > nginx-tests
comparison ssi_include_big.t @ 148:b714d6df958c
Tests: rename some tests for better sorting.
Use underscore instead of dash. Addtionally, rename some tests to better
match "module" + "details" scheme used: use "http_" prefix for http core
module tests, use "mail_" prefix for mail module tests.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Fri, 04 Mar 2011 16:07:15 +0300 |
parents | ssi-include-big.t@8ac1faaddd2c |
children | c0ae29632905 |
comparison
equal
deleted
inserted
replaced
147:fd865ada95c8 | 148:b714d6df958c |
---|---|
1 #!/usr/bin/perl | |
2 | |
3 # (C) Maxim Dounin | |
4 | |
5 # Tests for nginx ssi bug with big includes. | |
6 | |
7 ############################################################################### | |
8 | |
9 use warnings; | |
10 use strict; | |
11 | |
12 use Test::More; | |
13 | |
14 BEGIN { use FindBin; chdir($FindBin::Bin); } | |
15 | |
16 use lib 'lib'; | |
17 use Test::Nginx qw/ :DEFAULT :gzip /; | |
18 | |
19 ############################################################################### | |
20 | |
21 select STDERR; $| = 1; | |
22 select STDOUT; $| = 1; | |
23 | |
24 my $t = Test::Nginx->new()->has(qw/http ssi rewrite gzip proxy/)->plan(8); | |
25 | |
26 $t->write_file_expand('nginx.conf', <<'EOF'); | |
27 | |
28 %%TEST_GLOBALS%% | |
29 | |
30 master_process off; | |
31 daemon off; | |
32 | |
33 events { | |
34 } | |
35 | |
36 http { | |
37 %%TEST_GLOBALS_HTTP%% | |
38 | |
39 output_buffers 2 512; | |
40 ssi on; | |
41 gzip on; | |
42 | |
43 server { | |
44 listen 127.0.0.1:8080; | |
45 server_name localhost; | |
46 | |
47 location /proxy/ { | |
48 proxy_pass http://127.0.0.1:8080/local/; | |
49 } | |
50 location = /local/blah { | |
51 return 204; | |
52 } | |
53 } | |
54 } | |
55 | |
56 EOF | |
57 | |
58 $t->write_file('c1.html', 'X' x 1023); | |
59 $t->write_file('c2.html', 'X' x 1024); | |
60 $t->write_file('c3.html', 'X' x 1025); | |
61 $t->write_file('test1.html', '<!--#include virtual="/proxy/blah" -->' | |
62 . '<!--#include virtual="/c1.html" -->'); | |
63 $t->write_file('test2.html', '<!--#include virtual="/proxy/blah" -->' | |
64 . '<!--#include virtual="/c2.html" -->'); | |
65 $t->write_file('test3.html', '<!--#include virtual="/proxy/blah" -->' | |
66 . '<!--#include virtual="/c3.html" -->'); | |
67 $t->write_file('test4.html', '<!--#include virtual="/proxy/blah" -->' | |
68 . ('X' x 1025)); | |
69 | |
70 $t->run(); | |
71 | |
72 ############################################################################### | |
73 | |
74 my $t1 = http_gzip_request('/test1.html'); | |
75 ok(defined $t1, 'small included file (less than output_buffers)'); | |
76 http_gzip_like($t1, qr/^X{1023}\Z/, 'small included file content'); | |
77 | |
78 my $t2 = http_gzip_request('/test2.html'); | |
79 ok(defined $t2, 'small included file (equal to output_buffers)'); | |
80 http_gzip_like($t2, qr/^X{1024}\Z/, 'small included file content'); | |
81 | |
82 my $t3 = http_gzip_request('/test3.html'); | |
83 ok(defined $t3, 'big included file (more than output_buffers)'); | |
84 http_gzip_like($t3, qr/^X{1025}\Z/, 'big included file content'); | |
85 | |
86 my $t4 = http_gzip_request('/test4.html'); | |
87 ok(defined $t4, 'big ssi main file'); | |
88 http_gzip_like($t4, qr/^X{1025}\Z/, 'big ssi main file content'); | |
89 | |
90 ############################################################################### |