Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace JZlib by JRE Deflater/Inflater #114

Closed
hongospongo opened this issue Jan 28, 2022 · 4 comments
Closed

Replace JZlib by JRE Deflater/Inflater #114

hongospongo opened this issue Jan 28, 2022 · 4 comments

Comments

@hongospongo
Copy link

Version 0.1.65 integrated JZlib to allow the usage of [email protected] & zlib compressions.
I suggest including the code from http://www.jcraft.com/jsch/examples/CompressionJUZ.java instead, which wraps the native java.util.zip.Deflater/Inflater classes. This reduces library size and greatly improves compression performance.

NB: we have been using the above wrapper for many years without any problems.

@norrisjeremy
Copy link
Contributor

norrisjeremy commented Jan 28, 2022

So I have a couple concerns with fully removing the JZlib implementation and replacing it with this alternative:

  1. This JUZ implementation isn't technically compliant with RFC 4253 6.2, in that it performs Z_SYNC_FLUSH operations instead of Z_PARTIAL_FLUSH operations. In practice, this probably doesn't matter for interoperability purposes, since any usable Zlib implementation used by remote server for decompression should handle either operation. I've looked at a few other SSH implementations: OpenSSH, libssh & libssh2 all utilize Z_PARTIAL_FLUSH, while Dropbear, AsyncSSH & Mina SSHD all utilize Z_SYNC_FLUSH.
  2. This JUZ implementation doesn't contain any sort of copyright/license attribution. IANAL, so I'm uncertain how problematic this would be if we incorporated it into this fork.

We could possibly include it in this fork along side the JZlib implementation, since a user could opt into using it manually, although the unclear copyright/license for the code might be problematic with regards to directly distributing it.
@mwiede What are your thoughts?

@norrisjeremy
Copy link
Contributor

FYI, here is the original JSch-users thread on Sourceforge from whence this JUZ implementation appears to have originated.

@norrisjeremy
Copy link
Contributor

Also, here is a page that describes the differences between Z_PARTIAL_FLUSH & Z_SYNC_FLUSH.

@hongospongo
Copy link
Author

hongospongo commented Jan 28, 2022

To be honest, I was not aware of these subtle diffeneces in the zlib implementations. In my naive imagination I considered the JUZ code to be fully compatible,

So the only thing I can contribute at this point is to say that we are using the JUZ wrapper in a reallife project where we exchange large amout of data with about 100 different SFTP servers and that we never had any problems so far.

norrisjeremy added a commit to norrisjeremy/jsch that referenced this issue Feb 2, 2022
@mwiede mwiede closed this as completed Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants