release 1.7.6
[m6w6/ext-http] / tests / stream_filters_003.phpt
1 --TEST--
2 stream filter fun
3 --SKIPIF--
4 <?php
5 include 'skip.inc';
6 checkmin("5.2.5");
7 skipif(!http_support(HTTP_SUPPORT_ENCODINGS), "need zlib");
8 ?>
9 --FILE--
10 <?php
11 echo "-TEST\n";
12
13 define('OUT', fopen('php://output', 'w'));
14
15 stream_filter_append(OUT, 'http.chunked_encode');
16 stream_filter_append(OUT, 'http.deflate');
17 stream_filter_append(OUT, 'http.chunked_encode');
18 stream_filter_append(OUT, 'http.deflate');
19 stream_filter_append(OUT, 'http.inflate');
20 stream_filter_append(OUT, 'http.chunked_decode');
21 stream_filter_append(OUT, 'http.inflate');
22 stream_filter_append(OUT, 'http.chunked_decode');
23
24 $text = <<<SOME_TEXT
25 This is some stream filter fun; we'll see if it bails out or not.
26 The text should come out at the other end of the stream exactly like written to it.
27 Go figure!
28 SOME_TEXT;
29
30 srand(time());
31 foreach (str_split($text, 5) as $part) {
32 fwrite(OUT, $part);
33 if (rand(0, 1)) {
34 fflush(OUT);
35 }
36 }
37 ?>
38 --EXPECTF--
39 %aTEST
40 This is some stream filter fun; we'll see if it bails out or not.
41 The text should come out at the other end of the stream exactly like written to it.
42 Go figure!