release 1.7.6
[m6w6/ext-http] / tests / stream_filters_002.phpt
1 --TEST--
2 gzip stream filters
3 --SKIPIF--
4 <?php
5 include 'skip.inc';
6 checkver(5);
7 skipif(!http_support(HTTP_SUPPORT_ENCODINGS), "need zlib support");
8 ?>
9 --FILE--
10 <?php
11
12 echo "-TEST\n";
13
14 $d = file_get_contents(__FILE__);
15 $n = tempnam(dirname(__FILE__), 'hsf');
16
17 $f = fopen($n, 'wb');
18 stream_filter_append($f, 'http.deflate', STREAM_FILTER_WRITE, HTTP_DEFLATE_TYPE_GZIP);
19 fwrite($f, $d);
20 fflush($f);
21 fwrite($f, $d);
22 fclose($f);
23 var_dump($d.$d == http_inflate(file_get_contents($n)));
24
25 $f = fopen($n, 'wb');
26 stream_filter_append($f, 'http.deflate', STREAM_FILTER_WRITE);
27 fwrite($f, $d);
28 fflush($f);
29 fwrite($f, $d);
30 fclose($f);
31 var_dump($d.$d == http_inflate(file_get_contents($n)));
32
33 $f = fopen($n, 'wb');
34 stream_filter_append($f, 'http.deflate', STREAM_FILTER_WRITE, HTTP_DEFLATE_TYPE_RAW);
35 fwrite($f, $d);
36 fflush($f);
37 fwrite($f, $d);
38 fclose($f);
39 var_dump($d.$d == http_inflate(file_get_contents($n)));
40
41 unlink($n);
42
43 echo "Done\n";
44 ?>
45 --EXPECTF--
46 %aTEST
47 bool(true)
48 bool(true)
49 bool(true)
50 Done