Subject: Re: compression

Re: compression

From: Dave Hayden <dave_at_panic.com>
Date: Wed, 22 Aug 2012 14:56:27 -0700

On Aug 19, 2012, at 4:49 AM, Daniel Stenberg wrote:

> On Fri, 27 Jul 2012, Dave Hayden wrote:
>
>> Here's another stab at that code, adding a "use_in_auth" flag to the LIBSSH2_COMP_METHOD struct and a separate "zlib_at_openssh.com" method, along with checking session->state for LIBSSH2_STATE_AUTHENTICATED. Appears to work on the OpenSSH servers I've tried against, and it should work as before with normal zlib compression. (Unless, of course, I've messed something up..)
>
> Thanks, I've merged and pushed this patch now to allow everyone to try it out easier.

I just ran into a small problem with the compression code: libssh2 reports inflate()'s Z_BUF_ERROR return as an error (ultimately resulting in a read error coming out of the API), though it appears to be harmless. (See http://www.zlib.net/zlib_faq.html#faq05 )

I've changed the code to ignore it and it appears to be working fine so far. I'll keep an eye on it and let y'all know if we see any problems.

-Dave

--- libssh2/src/comp.c (revision 788)
+++ libssh2/src/comp.c (working copy)
@@ -318,7 +318,7 @@
 
                 status = inflate(strm, Z_PARTIAL_FLUSH);
 
- if (status != Z_OK) {
+ if (status != Z_OK && status != Z_BUF_ERROR) {
                     LIBSSH2_FREE(session, out);
                     _libssh2_debug(session, LIBSSH2_TRACE_TRANS,
                                    "unhandled zlib error %d", status);

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2012-08-22