Implement gzip decode

This commit is contained in:
Nigel Tao committed 2018-03-28 11:10:51 +11:00
1 parent a26e365992
commit 86d0ade206
6 files changed
+405 -13

No files matched your search

+3
View File
@@ -47,6 +47,8 @@ pub func decoder.decode?(dst writer1, src reader1)() {
if (x % 31) != 0 {
return error "invalid zlib parity check"
}
// Decode and checksum the DEFLATE-encoded payload.
var checksum u32
while true {
in.dst.mark()
@@ -59,6 +61,7 @@ pub func decoder.decode?(dst writer1, src reader1)() {
}
yield z
}
// TODO: read the 4 bytes regardless of this.ignore_checksum.
if (not this.ignore_checksum) and (checksum != in.src.read_u32be?()) {
return error "checksum mismatch"
}