comparison range.t @ 170:c5696c97c735

Tests: range not satisfiable tests.
author Maxim Dounin <mdounin@mdounin.ru>
date Tue, 30 Aug 2011 15:47:34 +0400
parents c0ae29632905
children 2fc8a41e3307
comparison
equal deleted inserted replaced
169:81559ffe5b45 170:c5696c97c735
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(qw/http charset/)->plan(25); 24 my $t = Test::Nginx->new()->has(qw/http charset/)->plan(31);
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
101 'multipart - content type'); 101 'multipart - content type');
102 like($t1, qr/X000XXXXXX/m, 'multipart - content 0-9'); 102 like($t1, qr/X000XXXXXX/m, 'multipart - content 0-9');
103 like($t1, qr/^X099XXXXXX\x0d?$/m, 'multipart - content -10 aka 990-999'); 103 like($t1, qr/^X099XXXXXX\x0d?$/m, 'multipart - content -10 aka 990-999');
104 like($t1, qr/X001XXXXXX\x0d?$/m, 'multipart - content 10-19'); 104 like($t1, qr/X001XXXXXX\x0d?$/m, 'multipart - content 10-19');
105 105
106 TODO: {
107 local $TODO = 'not yet';
108
109 $t1 = http_get_range('/t1.html', 'Range: bytes=0-9, -10, 100000-, 10-19');
110 like($t1, qr/206/, 'multipart big - 206 partial reply');
111 like($t1, qr/Content-Type: multipart\/byteranges; boundary=/,
112 'multipart big - content type');
113 like($t1, qr/X000XXXXXX/m, 'multipart big - content 0-9');
114 like($t1, qr/^X099XXXXXX\x0d?$/m, 'multipart big - content -10 aka 990-999');
115 like($t1, qr/X001XXXXXX\x0d?$/m, 'multipart big - content 10-19');
116
117 }
118
119 like(http_get_range('/t1.html', 'Range: bytes=100000-'), qr/416/,
120 'not satisfiable');
121
106 ############################################################################### 122 ###############################################################################
107 123
108 sub http_get_range { 124 sub http_get_range {
109 my ($url, $extra) = @_; 125 my ($url, $extra) = @_;
110 return http(<<EOF); 126 return http(<<EOF);