comparison gzip.t @ 116:c8341d95297e

Tests: add some HEAD gzip tests.
author Maxim Dounin <mdounin@mdounin.ru>
date Tue, 01 Dec 2009 19:38:22 +0300
parents 1c0ec30614c6
children 8ac1faaddd2c
comparison
equal deleted inserted replaced
115:cb1b04d8de29 116:c8341d95297e
19 ############################################################################### 19 ###############################################################################
20 20
21 select STDERR; $| = 1; 21 select STDERR; $| = 1;
22 select STDOUT; $| = 1; 22 select STDOUT; $| = 1;
23 23
24 my $t = Test::Nginx->new()->has('gzip')->plan(6); 24 my $t = Test::Nginx->new()->has('gzip')->plan(8);
25 25
26 $t->write_file_expand('nginx.conf', <<'EOF'); 26 $t->write_file_expand('nginx.conf', <<'EOF');
27 27
28 %%TEST_GLOBALS%% 28 %%TEST_GLOBALS%%
29 29
75 75
76 unlike(http_gzip_request('/'), qr/Accept-Ranges/im, 'cleared accept-ranges'); 76 unlike(http_gzip_request('/'), qr/Accept-Ranges/im, 'cleared accept-ranges');
77 unlike(http_gzip_request('/proxy/'), qr/Accept-Ranges/im, 77 unlike(http_gzip_request('/proxy/'), qr/Accept-Ranges/im,
78 'cleared headers from proxy'); 78 'cleared headers from proxy');
79 79
80 # HEAD requests should return correct headers
81
82 like(http_gzip_head('/'), qr/Content-Encoding: gzip/, 'gzip head');
83 unlike(http_head('/'), qr/Content-Encoding: gzip/, 'no gzip head');
84
80 ############################################################################### 85 ###############################################################################
86
87 sub http_gzip_head {
88 my ($uri) = @_;
89 return http(<<EOF);
90 HEAD $uri HTTP/1.1
91 Host: localhost
92 Connection: close
93 Accept-Encoding: gzip
94
95 EOF
96 }
97
98 ###############################################################################