Removed code using pipes for decompression and simplified decompress_data.
[elinks.git] / test / cgi / chunked_bzip2.py
blob3e07a174a83ae78b2c44b41ea0e058747556ebaf
1 #!/usr/bin/env python
2 import bz2, os, time
4 data1 = '<html><body>Two lines should be visible.<br/>The second line.</body></html>'
5 cd1 = bz2.compress(data1)
7 length = len(cd1)
8 next_chunk = hex(length - 10)[2:]
10 os.write(1, "Date: Sun, 20 Jan 2008 15:24:00 GMT\r\nServer: ddd\r\nTransfer-Encoding: chunked\r\nContent-Encoding: bzip2\r\nConnection: close\r\nContent-Type: text/html; charset=ISO-8859-1\r\n")
11 os.write(1, "\r\na\r\n")
12 os.write(1, cd1[:10])
13 time.sleep(2)
14 os.write(1, "\r\n%s\r\n" % next_chunk)
15 os.write(1, cd1[10:])
16 os.write(1, "\r\n0\r\n")