> One thing you could do is create a new command in the metadata standard to > specify that the data section is compressed with algorithm X. > > The other way we could go is rip Metadata-length out of storables and > instead > make it a mandatory client convention to include a FieldSet at the > beginning > of each document giving the metadata length and other optional flags like > Compression-zlib ... of course FCP and the reference clients would hide > that stuff from the user.
looking at the code, the simplest way to implement zlib compression is to change line 39 of Freenet/client/Document.java to read: this.data = new GZIPInputStream(source); (you'd also have to add import java.util.zip.* near the top to get it to compile) This would cause all data to be zlib compressed prior to encryption and decompressed following decryption. Of course this would be a non backwards compatible change that would break all existing freenet data, and leave no room for possible future compression algorithms, but it would be transparent enough. Adding compression dependent on metadata is a little trickier to do transparently. It would require tacking infomation on the end of the metadata input stream on inserts to specify the compression algorithm used, and prereading the metadata stream on data replies. This would be done in the FNPClient class. Prereading metadata on inserts would also allow for a compression algorithm to be selected based on the Format=<mime-type> or Content-type=<mime-type> field. Compression=none: application/mac-binhex40 application/zip application/vnd.ms-asf image/jpeg image/gif image/png audio/mpeg video/mpeg video/quicktime video/vnd.vivo Compression=zlib: everthing else does this seem reasonable to everyone? l8r Aaron _______________________________________________ Devl mailing list Devl at freenetproject.org http://lists.freenetproject.org/mailman/listinfo/devl
