REBOL3 tracker
  0.9.12 beta
Ticket #0001679 User: anonymous

Project:



rss
TypeWish Statusreviewed Date19-Oct-2010 16:30
Versionalpha 108 CategoryNative Submitted byoldes
PlatformAll Severityminor Prioritynormal

Summary Native GZIP compress/decompress suport
Description It would be very useful to have native support for gzip in the COMPRESS and DECOMPRESS functions. And it requires very little, just to add missing CRC-32 checksum method and generate (or parse for DECOMPRESS) different metadata (headers and magic number). The actual compression algorithm and compressed data would be the same.

See http://tools.ietf.org/html/rfc1952 for details, and the example code and attached file for sample data.
Example code
; Preferred behavior
>> compress/gzip "foo"
== #{1F8B0800EF46BE4C00034BCBCF07002165738C03000000}
>> decompress #{1F8B0800EF46BE4C00034BCBCF07002165738C03000000}
== #{666F6F} ; to-binary "foo"
>> decompress/gzip #{1F8B0800EF46BE4C00034BCBCF07002165738C03000000}
== #{666F6F}
>> decompress/gzip compress/gzip "foo"
== #{666F6F}
>> decompress/gzip compress "foo"
; This should trigger an error
>> to-string decompress/gzip %test.txt.gz
== "Hello REBOL."

Assigned ton/a Fixed in- Last Update30-Oct-2010 19:56

Attached Files

Comments
(0002605)
abolka
19-Oct-2010 19:22

See also bugs #328 and #1667.
(0002608)
Carl
19-Oct-2010 20:37

Test these well:

compress/gzip
decompress/gzip

(0002612)
abolka
20-Oct-2010 03:20

Trying to decompress above attached file fails in A108:

>> decompress/gzip read %test.txt.gz
** Script error: value out of range: none
** Where: decompress
** Near: decompress/gzip read %test.txt.gz

Also, a simple round-trip test fails:

>> decompress/gzip compress/gzip "foo"
** Script error: invalid compressed data - problem: -3
** Where: decompress
** Near: decompress/gzip compress/gzip "foo"

Further, it seems compress/gzip does not really produce compressed data in the gzip format. `compress/gzip "foo"` should result in #{1F8B0800EF46BE4C00034BCBCF07002165738C03000000}.
(0002629)
BrianH
20-Oct-2010 05:08

Note: The magic number at the beginning of gzip data should be enough for DECOMPRESS to autodetect that the data is gzip format and act accordingly. Therefore, the main purpose of the DECOMPRESS /gzip option would be to insist that the data is gzip encoded, and trigger an error if it is not.

Adjusted the ticket accordingly.
(0002633)
Carl
20-Oct-2010 06:57

Abolka: odd... those were some of the tests that passed... will check on it.

Regarding the magic number, is there a decent spec on it? The mod I made was simply that described in earlier REBOL examples, and does not appear to be adequate.
(0002702)
abolka
30-Oct-2010 19:56

Testcases added to the test suite (354a7d0).

Date User Field Action Change
30-Oct-2010 19:56 abolka Comment : 0002702 Added -
20-Oct-2010 06:57 carl Comment : 0002633 Added -
20-Oct-2010 05:29 BrianH Description Modified -
20-Oct-2010 05:26 BrianH Description Modified -
20-Oct-2010 05:21 BrianH Code Modified -
20-Oct-2010 05:16 BrianH Comment : 0002629 Modified -
20-Oct-2010 05:14 BrianH Description Modified -
20-Oct-2010 05:14 BrianH Status Modified built => reviewed
20-Oct-2010 05:14 BrianH Category Modified Unspecified => Native
20-Oct-2010 05:14 BrianH Fixedin Modified alpha 108 => none
20-Oct-2010 05:14 BrianH Code Modified -
20-Oct-2010 05:08 BrianH Comment : 0002629 Added -
20-Oct-2010 04:31 abolka Comment : 0002612 Modified -
20-Oct-2010 03:41 abolka Comment : 0002612 Modified -
20-Oct-2010 03:27 abolka Comment : 0002612 Modified -
20-Oct-2010 03:20 abolka Comment : 0002612 Added -
19-Oct-2010 20:37 carl Comment : 0002608 Added -
19-Oct-2010 20:35 carl Status Modified reviewed => built
19-Oct-2010 20:35 carl Fixedin Modified => alpha 108
19-Oct-2010 20:06 carl Status Modified submitted => reviewed
19-Oct-2010 19:22 abolka Comment : 0002605 Added -
19-Oct-2010 16:30 oldes Ticket Added -