From libssh2-devel-bounces@cool.haxx.se  Sat Jan 11 19:44:40 2020
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (mail [127.0.0.1])
	by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTP id 00BIi589029042;
	Sat, 11 Jan 2020 19:44:29 +0100
Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com
 [IPv6:2607:f8b0:4864:20:0:0:0:102d])
 by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTPS id 00BIi3Ws028900
 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Sat, 11 Jan 2020 19:44:04 +0100
Received: by mail-pj1-x102d.google.com with SMTP id a6so2359105pjh.2
 for <libssh2-devel@cool.haxx.se>; Sat, 11 Jan 2020 10:44:05 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=date:user-agent:in-reply-to:references:mime-version
 :content-transfer-encoding:subject:to:from:message-id;
 bh=/oqeFsQ5g5/cqMVOexf2x6ewjtxEC1W+Ptrf9QeZ2Bg=;
 b=K/mgNNjXeyt3DW7uy91Qj8oXQmmxoJrW+jgK6QCOo4mhFcXG10OQUCxryXqjPblv3H
 U/SM0a/K7olverUxPQFxDGjmQ0XGzjWwB+54k8VaAhVcpXVGuGroIwL+V+gKhXt53ddR
 JsVe49J718f9bbGUMf9xSozPs3U/2BA9rW15JzncTy5CHxC95quVDAKYz/S1CUnTNlth
 dPPZ3yLLuQgSpAa2QIcRyWvTBMcIs2Wg0aLw98WYAYLuS4TJLq99aUl51D4XrNXGYYuG
 Kk9o/zepUDbLmSlxs9UpF5Q4uXZL9fIhQX9/VQXbQMW1hNo87R1NErUHzV4qFKCc9ouf
 D3fg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:date:user-agent:in-reply-to:references
 :mime-version:content-transfer-encoding:subject:to:from:message-id;
 bh=/oqeFsQ5g5/cqMVOexf2x6ewjtxEC1W+Ptrf9QeZ2Bg=;
 b=DISuAg59c6ArH68+vxC3zja8WeRhRAbqhtBtpzGD8T0mbotxBIwJpajGMzcVZeg0y6
 EqabLUlvwyljxEfFhP6yaZ1cOefVd5vsXZZBWKCaYiqTi2XELlFlW+cZiOYO68wS9Jot
 KPOqEQAuPAXRRnbNYvlH3mLVgocYiPbY5Ya6GizGM1swr+LLmftHsA7jxQgn+qYmaD1p
 vsVKYca43/8YrFAbfEidFaGuymfLVEHgkrJCO9GJ5qajGmbTQFYtRJCNuzdUoJHKsGX7
 X1lQNaSFjfm7pjAqGytpx7S0542a7a9232L56wlltPzXZIfgVH7lFTG0UJDLcIdLqY8J
 jgpg==
X-Gm-Message-State: APjAAAXYKUjbnXvRfBHtxV4ohzIjBr8iADl84MQJUsMmo5+MOuLIXY+g
 RXioTfcqs0Y3LZGmO1lYYzdchAWi
X-Google-Smtp-Source: APXvYqwaFheBvspLdT2SX8Bx4fW6w3ZxCJMOXcmKUQYq+F4jaMDVNO9LMKs70rbkujdk+a+POJmaPg==
X-Received: by 2002:a17:90a:246c:: with SMTP id
 h99mr13431659pje.134.1578768237009; 
 Sat, 11 Jan 2020 10:43:57 -0800 (PST)
Received: from Samsung-Galaxy-Halo.SpaceNet
 (c-73-42-186-179.hsd1.wa.comcast.net. [73.42.186.179])
 by smtp.gmail.com with ESMTPSA id p5sm7227077pgs.28.2020.01.11.10.43.55
 for <libssh2-devel@cool.haxx.se>
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Sat, 11 Jan 2020 10:43:56 -0800 (PST)
Date: Sat, 11 Jan 2020 10:43:53 -0800
User-Agent: K-9 Mail for Android
In-Reply-To: <2a5aaca31006476791ad8dc8d5381742@ipaper.com>
References: <2a5aaca31006476791ad8dc8d5381742@ipaper.com>
MIME-Version: 1.0
Subject: libssh2_sftp_init() hangs with zlib compression turned on
To: libssh2-devel@cool.haxx.se
From: Gebi Miguel <gebi.miguel@gmail.com>
Message-ID: <A952AC6E-3C84-4FB3-A51A-F837B8A3F089@gmail.com>
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <https://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
Content-Type: multipart/mixed; boundary="===============1769058278=="
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>

--===============1769058278==
Content-Type: multipart/alternative; boundary="----RF2U1D2DROHST4J65RSRBYR12AJ5WK"
Content-Transfer-Encoding: 7bit

------RF2U1D2DROHST4J65RSRBYR12AJ5WK
Content-Type: text/plain;
 charset=utf-8
Content-Transfer-Encoding: quoted-printable

When building libSSH2 v1=2E9=2E0 with just

cmake =2E=2E -DENABLE_ZLIB_COMPRESSION=3DOFF -DCRYPTO_BACKEND=3DWinCNG -DE=
NABLE_DEBUG_LOGGING=3DON

the example sftp_write_nonblock=2Ec works perfectly fine=2E  The trouble s=
tarts when I add zlib compression=2E  The current zlib-1=2E2=2E11 has been =
built with all the default settings ("cmake =2E=2E")=2E  Then I build libSS=
H2 with:

cmake =2E=2E -DENABLE_ZLIB_COMPRESSION=3DON -DZLIB_LIBRARY=3D=2E=2E/=2E=2E=
/zlib-1=2E2=2E11/myBuild/Debug/zlibstaticd=2Elib -DZLIB_INCLUDE_DIR=3D=2E=
=2E/=2E=2E/zlib-1=2E2=2E11 -DCRYPTO_BACKEND=3DWinCNG -DENABLE_DEBUG_LOGGING=
=3DON

Using sftp_write_nonblock=2Ec again the function libssh2_sftp_init() never=
 returns=2E  I've added the line "libssh2_trace (session, ~0);" to the exam=
ple just before libssh2_sftp_init() and that results in:


Fingerprint: 62 70 7B 7B FB DA 65 4C 73 07 D1 2F E0 19 89 CF 4C 3A F5 93
libssh2_sftp_init()!
[libssh2] 0=2E196284 SFTP: Initializing SFTP subsystem
[libssh2] 0=2E197269 Conn: Allocated new channel ID#0
[libssh2] 0=2E199265 Conn: Opening Channel - win 2097152 pack 32768
=3D> libssh2_transport_write plain (24 bytes)
0000: 5A 00 00 00 07 73 65 73  73 69 6F 6E 00 00 00 00 : Z=2E=2E=2E=2Esess=
ion=2E=2E=2E=2E
0010: 00 20 00 00 00 00 80 00                          : =2E =2E=2E=2E=2E=
=2E=2E
[libssh2] 0=2E206249 Socket: Sent 80/80 bytes at 00EB7880
=3D> libssh2_transport_write send() (80 bytes)
0000: 3A 86 97 55 4B 04 BD FB  1D B9 94 0C 11 1E FF AF : :=2E=2EUK=2E=2E=
=2E=2E=2E=2E=2E=2E=2E=2E=2E
0010: 85 30 05 25 07 9B 03 35  F9 3E 46 41 BC A7 8C 12 : =2E0=2E%=2E=2E=2E=
5=2E>FA=2E=2E=2E=2E
0020: BA 1A E4 3B 22 C1 35 14  5C F8 F2 3E C5 A9 11 A7 : =2E=2E=2E;"=2E5=
=2E\=2E=2E>=2E=2E=2E=2E
0030: 58 8E FE 78 8A 10 BE 46  95 2C 79 C3 93 95 E1 85 : X=2E=2Ex=2E=2E=2E=
F=2E,y=2E=2E=2E=2E=2E
0040: A3 0B F3 72 3F E8 89 ED  DE 91 78 3F C7 CE 28 F2 : =2E=2E=2Er?=2E=2E=
=2E=2E=2Ex?=2E=2E(=2E
[libssh2] 0=2E220210 Transport: Looking for packet of type: 91
[libssh2] 0=2E221207 Transport: Looking for packet of type: 92
[libssh2] 0=2E296930 Socket: Recved 64/16384 bytes to 00EB3858+0
=3D> libssh2_transport_read() raw (64 bytes)
0000: A7 62 7B D8 05 C6 E2 87  FE 1F 96 DF B8 CA C8 2C : =2Eb{=2E=2E=2E=2E=
=2E=2E=2E=2E=2E=2E=2E=2E,
0010: 51 57 54 FE 1E A5 F6 3D  69 40 C8 CE 6A B7 4D AB : QWT=2E=2E=2E=2E=
=3Di@=2E=2Ej=2EM=2E
0020: 2C 2A 3C 9E 9A 27 31 B6  99 33 C2 0D A5 78 4E DF : ,*<=2E=2E'1=2E=2E=
3=2E=2E=2ExN=2E
0030: 60 BD 2C BC A1 56 56 B4  72 20 7B 97 63 CE AA 93 : `=2E,=2E=2EVV=2Er=
 {=2Ec=2E=2E=2E
=3D> libssh2_transport_read() plain (17 bytes)
0000: 5B 00 00 00 00 00 00 00  00 00 00 00 00 00 00 80 : [=2E=2E=2E=2E=2E=
=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E
0010: 00                                               : =2E
[libssh2] 0=2E315881 Transport: Packet type 91 received, length=3D17
[libssh2] 0=2E317889 Transport: Looking for packet of type: 91
[libssh2] 0=2E319886 Conn: Connection Established - ID: 0/0 win: 0/2097152=
 pack: 32768/32768
[libssh2] 0=2E322879 Conn: starting request(subsystem) on channel 0/0, mes=
sage=3Dsftp
=3D> libssh2_transport_write plain (23 bytes)
0000: 62 00 00 00 00 00 00 00  09 73 75 62 73 79 73 74 : b=2E=2E=2E=2E=2E=
=2E=2E=2Esubsyst
0010: 65 6D 01 00 00 00 04                             : em=2E=2E=2E=2E=2E
=3D> libssh2_transport_write plain2 (4 bytes)
0000: 73 66 74 70                                      : sftp
[libssh2] 0=2E336827 Socket: Sent 80/80 bytes at 00EB7880
=3D> libssh2_transport_write send() (80 bytes)
0000: 3B 7A C2 06 CC 91 EA 2C  C1 8A 01 95 B8 8F CB EE : ;z=2E=2E=2E=2E=2E=
,=2E=2E=2E=2E=2E=2E=2E=2E
0010: D3 11 28 D0 DD 6B 31 9B  13 99 41 AF EB 16 1C 26 : =2E=2E(=2E=2Ek1=
=2E=2E=2EA=2E=2E=2E=2E&
0020: 45 6C 94 41 19 A4 2E 09  9D 7E 0F 0F 92 5E A3 5E : El=2EA=2E=2E=2E=
=2E=2E~=2E=2E=2E^=2E^
0030: A5 B0 42 1C 91 6A 77 11  27 BE C9 92 3F C2 1F DA : =2E=2EB=2E=2Ejw=
=2E'=2E=2E=2E?=2E=2E=2E
0040: C4 9B 39 A6 76 AC 35 8F  59 C5 45 C5 83 39 9E A2 : =2E=2E9=2Ev=2E5=
=2EY=2EE=2E=2E9=2E=2E
[libssh2] 0=2E356774 Transport: Looking for packet of type: 99
[libssh2] 0=2E358769 Transport: Looking for packet of type: 100
[libssh2] 0=2E424455 Socket: Recved 112/16384 bytes to 00EB3858+0
=3D> libssh2_transport_read() raw (112 bytes)
0000: 00 08 B4 D7 D4 38 8C 3C  16 08 EA 58 50 86 49 52 : =2E=2E=2E=2E=2E8=
=2E<=2E=2E=2EXP=2EIR
0010: 0D 68 12 3B 9A 97 D5 EC  21 9C D6 84 6F E6 AC C6 : =2Eh=2E;=2E=2E=2E=
=2E!=2E=2E=2Eo=2E=2E=2E
0020: CF B8 79 C0 59 18 2F A7  82 5F 9E 64 5D 7C 15 B5 : =2E=2Ey=2EY=2E/=
=2E=2E_=2Ed]|=2E=2E
0030: 6C 86 70 30 D0 4E 13 15  40 75 00 49 E7 B7 10 B6 : l=2Ep0=2EN=2E=2E@=
u=2EI=2E=2E=2E=2E
0040: E7 B1 F9 A1 DF 0C 80 F1  35 41 35 51 79 E0 CB 57 : =2E=2E=2E=2E=2E=
=2E=2E=2E5A5Qy=2E=2EW
0050: AF 62 49 52 D6 B9 05 91  F7 5C 8C C1 FD 26 3B 3D : =2EbIR=2E=2E=2E=
=2E=2E\=2E=2E=2E&;=3D
0060: 47 94 62 E4 2D A2 EA 0E  82 5C 42 42 AB C2 97 E6 : G=2Eb=2E-=2E=2E=
=2E=2E\BB=2E=2E=2E=2E
=3D> libssh2_transport_read() plain (9 bytes)
0000: 5D 00 00 00 00 00 03 F7  C0                      : ]=2E=2E=2E=2E=2E=
=2E=2E=2E
[libssh2] 0=2E449138 Transport: Packet type 93 received, length=3D9
[libssh2] 0=2E453128 Conn: Window adjust for channel 0/0, adding 260032 by=
tes, new window_size=3D260032
=3D> libssh2_transport_read() plain (5 bytes)
0000: 63 00 00 00 00                                   : c=2E=2E=2E=2E
[libssh2] 0=2E462104 Transport: Packet type 99 received, length=3D5
[libssh2] 0=2E464098 Transport: Looking for packet of type: 99
[libssh2] 0=2E466093 Conn: Setting channel 0/0 handle_extended_data mode t=
o 1
[libssh2] 0=2E467090 SFTP: Sending FXP_INIT packet advertising version 3 s=
upport
[libssh2] 0=2E469085 Conn: Writing 9 bytes on channel 0/0, stream #0


This last line is always where things end=2E  When I "break" the running p=
rocess in Visual Studio I end up on line 140 in misc=2Ec, at the call

rc =3D recv(sock, buffer, length, flags);

within _libssh2_recv()=2E  My OS is Windows 10, I've tried with Visual Stu=
dio 2017 and 2010, shared and static libraries, different SFTP servers (tes=
t=2Erebex=2Enet, a couple on the local network and RebexTinySftpServer=2Eex=
e), the result is always the same, cannot make it beyond libssh2_sftp_init(=
) with zlib compression turned on=2E

Any suggestions?  Thank you very much for your time!

------RF2U1D2DROHST4J65RSRBYR12AJ5WK
Content-Type: text/html;
 charset=utf-8
Content-Transfer-Encoding: quoted-printable

When building libSSH2 v1=2E9=2E0 with just<br><br>cmake =2E=2E -DENABLE_ZLI=
B_COMPRESSION=3DOFF -DCRYPTO_BACKEND=3DWinCNG -DENABLE_DEBUG_LOGGING=3DON<b=
r><br>the example sftp_write_nonblock=2Ec works perfectly fine=2E  The trou=
ble starts when I add zlib compression=2E  The current zlib-1=2E2=2E11 has =
been built with all the default settings ("cmake =2E=2E")=2E  Then I build =
libSSH2 with:<br><br>cmake =2E=2E -DENABLE_ZLIB_COMPRESSION=3DON -DZLIB_LIB=
RARY=3D=2E=2E/=2E=2E/zlib-1=2E2=2E11/myBuild/Debug/zlibstaticd=2Elib -DZLIB=
_INCLUDE_DIR=3D=2E=2E/=2E=2E/zlib-1=2E2=2E11 -DCRYPTO_BACKEND=3DWinCNG -DEN=
ABLE_DEBUG_LOGGING=3DON<br><br>Using sftp_write_nonblock=2Ec again the func=
tion libssh2_sftp_init() never returns=2E  I've added the line "libssh2_tra=
ce (session, ~0);" to the example just before libssh2_sftp_init() and that =
results in:<br><br><br>Fingerprint: 62 70 7B 7B FB DA 65 4C 73 07 D1 2F E0 =
19 89 CF 4C 3A F5 93<br>libssh2_sftp_init()!<br>[libssh2] 0=2E196284 SFTP: =
Initializing SFTP subsystem<br>[libssh2] 0=2E197269 Conn: Allocated new cha=
nnel ID#0<br>[libssh2] 0=2E199265 Conn: Opening Channel - win 2097152 pack =
32768<br>=3D&gt; libssh2_transport_write plain (24 bytes)<br>0000: 5A 00 00=
 00 07 73 65 73  73 69 6F 6E 00 00 00 00 : Z=2E=2E=2E=2Esession=2E=2E=2E=2E=
<br>0010: 00 20 00 00 00 00 80 00                          : =2E =2E=2E=2E=
=2E=2E=2E<br>[libssh2] 0=2E206249 Socket: Sent 80/80 bytes at 00EB7880<br>=
=3D&gt; libssh2_transport_write send() (80 bytes)<br>0000: 3A 86 97 55 4B 0=
4 BD FB  1D B9 94 0C 11 1E FF AF : :=2E=2EUK=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=
=2E<br>0010: 85 30 05 25 07 9B 03 35  F9 3E 46 41 BC A7 8C 12 : =2E0=2E%=2E=
=2E=2E5=2E&gt;FA=2E=2E=2E=2E<br>0020: BA 1A E4 3B 22 C1 35 14  5C F8 F2 3E =
C5 A9 11 A7 : =2E=2E=2E;"=2E5=2E\=2E=2E&gt;=2E=2E=2E=2E<br>0030: 58 8E FE 7=
8 8A 10 BE 46  95 2C 79 C3 93 95 E1 85 : X=2E=2Ex=2E=2E=2EF=2E,y=2E=2E=2E=
=2E=2E<br>0040: A3 0B F3 72 3F E8 89 ED  DE 91 78 3F C7 CE 28 F2 : =2E=2E=
=2Er?=2E=2E=2E=2E=2Ex?=2E=2E(=2E<br>[libssh2] 0=2E220210 Transport: Looking=
 for packet of type: 91<br>[libssh2] 0=2E221207 Transport: Looking for pack=
et of type: 92<br>[libssh2] 0=2E296930 Socket: Recved 64/16384 bytes to 00E=
B3858+0<br>=3D&gt; libssh2_transport_read() raw (64 bytes)<br>0000: A7 62 7=
B D8 05 C6 E2 87  FE 1F 96 DF B8 CA C8 2C : =2Eb{=2E=2E=2E=2E=2E=2E=2E=2E=
=2E=2E=2E=2E,<br>0010: 51 57 54 FE 1E A5 F6 3D  69 40 C8 CE 6A B7 4D AB : Q=
WT=2E=2E=2E=2E=3Di@=2E=2Ej=2EM=2E<br>0020: 2C 2A 3C 9E 9A 27 31 B6  99 33 C=
2 0D A5 78 4E DF : ,*&lt;=2E=2E'1=2E=2E3=2E=2E=2ExN=2E<br>0030: 60 BD 2C BC=
 A1 56 56 B4  72 20 7B 97 63 CE AA 93 : `=2E,=2E=2EVV=2Er {=2Ec=2E=2E=2E<br=
>=3D&gt; libssh2_transport_read() plain (17 bytes)<br>0000: 5B 00 00 00 00 =
00 00 00  00 00 00 00 00 00 00 80 : [=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=
=2E=2E=2E<br>0010: 00                                               : =2E<b=
r>[libssh2] 0=2E315881 Transport: Packet type 91 received, length=3D17<br>[=
libssh2] 0=2E317889 Transport: Looking for packet of type: 91<br>[libssh2] =
0=2E319886 Conn: Connection Established - ID: 0/0 win: 0/2097152 pack: 3276=
8/32768<br>[libssh2] 0=2E322879 Conn: starting request(subsystem) on channe=
l 0/0, message=3Dsftp<br>=3D&gt; libssh2_transport_write plain (23 bytes)<b=
r>0000: 62 00 00 00 00 00 00 00  09 73 75 62 73 79 73 74 : b=2E=2E=2E=2E=2E=
=2E=2E=2Esubsyst<br>0010: 65 6D 01 00 00 00 04                             =
: em=2E=2E=2E=2E=2E<br>=3D&gt; libssh2_transport_write plain2 (4 bytes)<br>=
0000: 73 66 74 70                                      : sftp<br>[libssh2] =
0=2E336827 Socket: Sent 80/80 bytes at 00EB7880<br>=3D&gt; libssh2_transpor=
t_write send() (80 bytes)<br>0000: 3B 7A C2 06 CC 91 EA 2C  C1 8A 01 95 B8 =
8F CB EE : ;z=2E=2E=2E=2E=2E,=2E=2E=2E=2E=2E=2E=2E=2E<br>0010: D3 11 28 D0 =
DD 6B 31 9B  13 99 41 AF EB 16 1C 26 : =2E=2E(=2E=2Ek1=2E=2E=2EA=2E=2E=2E=
=2E&amp;<br>0020: 45 6C 94 41 19 A4 2E 09  9D 7E 0F 0F 92 5E A3 5E : El=2EA=
=2E=2E=2E=2E=2E~=2E=2E=2E^=2E^<br>0030: A5 B0 42 1C 91 6A 77 11  27 BE C9 9=
2 3F C2 1F DA : =2E=2EB=2E=2Ejw=2E'=2E=2E=2E?=2E=2E=2E<br>0040: C4 9B 39 A6=
 76 AC 35 8F  59 C5 45 C5 83 39 9E A2 : =2E=2E9=2Ev=2E5=2EY=2EE=2E=2E9=2E=
=2E<br>[libssh2] 0=2E356774 Transport: Looking for packet of type: 99<br>[l=
ibssh2] 0=2E358769 Transport: Looking for packet of type: 100<br>[libssh2] =
0=2E424455 Socket: Recved 112/16384 bytes to 00EB3858+0<br>=3D&gt; libssh2_=
transport_read() raw (112 bytes)<br>0000: 00 08 B4 D7 D4 38 8C 3C  16 08 EA=
 58 50 86 49 52 : =2E=2E=2E=2E=2E8=2E&lt;=2E=2E=2EXP=2EIR<br>0010: 0D 68 12=
 3B 9A 97 D5 EC  21 9C D6 84 6F E6 AC C6 : =2Eh=2E;=2E=2E=2E=2E!=2E=2E=2Eo=
=2E=2E=2E<br>0020: CF B8 79 C0 59 18 2F A7  82 5F 9E 64 5D 7C 15 B5 : =2E=
=2Ey=2EY=2E/=2E=2E_=2Ed]|=2E=2E<br>0030: 6C 86 70 30 D0 4E 13 15  40 75 00 =
49 E7 B7 10 B6 : l=2Ep0=2EN=2E=2E@u=2EI=2E=2E=2E=2E<br>0040: E7 B1 F9 A1 DF=
 0C 80 F1  35 41 35 51 79 E0 CB 57 : =2E=2E=2E=2E=2E=2E=2E=2E5A5Qy=2E=2EW<b=
r>0050: AF 62 49 52 D6 B9 05 91  F7 5C 8C C1 FD 26 3B 3D : =2EbIR=2E=2E=2E=
=2E=2E\=2E=2E=2E&amp;;=3D<br>0060: 47 94 62 E4 2D A2 EA 0E  82 5C 42 42 AB =
C2 97 E6 : G=2Eb=2E-=2E=2E=2E=2E\BB=2E=2E=2E=2E<br>=3D&gt; libssh2_transpor=
t_read() plain (9 bytes)<br>0000: 5D 00 00 00 00 00 03 F7  C0              =
        : ]=2E=2E=2E=2E=2E=2E=2E=2E<br>[libssh2] 0=2E449138 Transport: Pack=
et type 93 received, length=3D9<br>[libssh2] 0=2E453128 Conn: Window adjust=
 for channel 0/0, adding 260032 bytes, new window_size=3D260032<br>=3D&gt; =
libssh2_transport_read() plain (5 bytes)<br>0000: 63 00 00 00 00           =
                        : c=2E=2E=2E=2E<br>[libssh2] 0=2E462104 Transport: =
Packet type 99 received, length=3D5<br>[libssh2] 0=2E464098 Transport: Look=
ing for packet of type: 99<br>[libssh2] 0=2E466093 Conn: Setting channel 0/=
0 handle_extended_data mode to 1<br>[libssh2] 0=2E467090 SFTP: Sending FXP_=
INIT packet advertising version 3 support<br>[libssh2] 0=2E469085 Conn: Wri=
ting 9 bytes on channel 0/0, stream #0<br><br><br>This last line is always =
where things end=2E  When I "break" the running process in Visual Studio I =
end up on line 140 in misc=2Ec, at the call<br><br>rc =3D recv(sock, buffer=
, length, flags);<br><br>within _libssh2_recv()=2E  My OS is Windows 10, I'=
ve tried with Visual Studio 2017 and 2010, shared and static libraries, dif=
ferent SFTP servers (test=2Erebex=2Enet, a couple on the local network and =
RebexTinySftpServer=2Eexe), the result is always the same, cannot make it b=
eyond libssh2_sftp_init() with zlib compression turned on=2E<br><br>Any sug=
gestions?  Thank you very much for your time!<br>
------RF2U1D2DROHST4J65RSRBYR12AJ5WK--

--===============1769058278==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline

X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KbGlic3NoMi1k
ZXZlbCBodHRwczovL2Nvb2wuaGF4eC5zZS9jZ2ktYmluL21haWxtYW4vbGlzdGluZm8vbGlic3No
Mi1kZXZlbAo=

--===============1769058278==--

From libssh2-devel-bounces@cool.haxx.se  Mon Jan 13 17:16:02 2020
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (mail [127.0.0.1])
	by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTP id 00DGFRc8021537;
	Mon, 13 Jan 2020 17:15:53 +0100
Received: from foo.stuge.se (foo.stuge.se [212.116.89.98])
 by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTPS id 00DGFQf9021362
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Mon, 13 Jan 2020 17:15:26 +0100
Received: (qmail 30404 invoked by uid 1000); 13 Jan 2020 16:15:20 -0000
Message-ID: <20200113161520.30403.qmail@stuge.se>
Date: Mon, 13 Jan 2020 16:15:20 +0000
From: Peter Stuge <peter@stuge.se>
To: libssh2-devel@cool.haxx.se
Subject: Re: libssh2_sftp_init() hangs with zlib compression turned on
References: <2a5aaca31006476791ad8dc8d5381742@ipaper.com>
 <A952AC6E-3C84-4FB3-A51A-F837B8A3F089@gmail.com>
MIME-Version: 1.0
Content-Disposition: inline
In-Reply-To: <A952AC6E-3C84-4FB3-A51A-F837B8A3F089@gmail.com>
X-MIME-Autoconverted: from quoted-printable to 8bit by giant.haxx.se id
 00DGFQf9021362
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <https://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
Content-Type: text/plain; charset="utf-8"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id 00DGFRc8021537

Gebi Miguel wrote:
..
> [libssh2] 0.467090 SFTP: Sending FXP_INIT packet advertising version 3 support
> [libssh2] 0.469085 Conn: Writing 9 bytes on channel 0/0, stream #0

Thanks for providing this debug output.


> This last line is always where things end.  When I "break" the running
> process in Visual Studio I end up on line 140 in misc.c, at the call
> 
> rc = recv(sock, buffer, length, flags);
> 
> within _libssh2_recv().  My OS is Windows 10,
..
> the result is always the same, cannot make it beyond libssh2_sftp_init()
> with zlib compression turned on.
> 
> Any suggestions?  Thank you very much for your time!

I guess that the compressed packets are actually not completely correct,
and that the server thus never sends any reply.

Can you also enable transport layer tracing, and look at the
difference in output between libssh2 with and without zlib?

Possibly add debugdump() calls around/after compression in transport.c,
look for this line:

  rc = session->local.comp->comp(session,

The next step would then be to manually decompress/decode the packets
as sent by libssh2 built with zlib, to validate whether they are actually
correct. The list might be able to help with that if you post output
from added debugdump() calls.


Kind regards

//Peter

_______________________________________________
libssh2-devel https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Mon Jan 13 22:26:23 2020
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (mail [127.0.0.1])
	by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTP id 00DLQ2Bx003816;
	Mon, 13 Jan 2020 22:26:19 +0100
Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com
 [IPv6:2607:f8b0:4864:20:0:0:0:42c])
 by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTPS id 00DLQ0go003756
 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Mon, 13 Jan 2020 22:26:01 +0100
Received: by mail-pf1-x42c.google.com with SMTP id q8so5479881pfh.7
 for <libssh2-devel@cool.haxx.se>; Mon, 13 Jan 2020 13:26:02 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=date:user-agent:in-reply-to:references:mime-version
 :content-transfer-encoding:subject:to:from:message-id;
 bh=IvWo6EAzpzonDs45OBY9LycgD5iI3jNdG+cC/bUZp2E=;
 b=LeUin89Tk4KmvY8mByChoSNU2VKhBUKw3Gahpc5xzQZMvpLCmm2Gr2dUIPzAjfn1U0
 F2DgBpL457xsQ9x0KlqnWDM7hg7Z7jUw5vMRfidlHBxGjdSsKC7gClbzFHcdKfgQ8etJ
 nC8MYOp/tDsJ3trDyRdjfouR3utnenKP1Dhik7eRIRLydbN5SgC2gDwqvzLsuE8P14od
 /722fliwYKegzXdW+UGPgU2Ympa3mRl/Is2lD8WjF1y25xLxKY17sKszPWIB+RuOHpzd
 Ddxx2nXt30kmHu0k/W6HXN4dkQyN++ySyuep6xA/dmPqQOMIcsUUp0NRTMnHrGOp5P/N
 uRtA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:date:user-agent:in-reply-to:references
 :mime-version:content-transfer-encoding:subject:to:from:message-id;
 bh=IvWo6EAzpzonDs45OBY9LycgD5iI3jNdG+cC/bUZp2E=;
 b=MhxmQNuWv8z/ObECIVvt/o99ObgSUAqC9vEq2wo/f0mYy7jaHJ65FdsBjd/4Sn7aD7
 93qy6mX1/DEvAlKJbigZKyT9fd7S89t+RpYUps5A9SYttgTUpUpDfMX9IHAzPEqtV5N+
 p7sRvymj2ZpzAYhGU4mOnPj/eLZ1WRK5F1pY9NPn0Ch4AQZfB1hEz/8/Rl7qi6CNh54s
 1GYmRdLVgKfB0wu+PbKRZvcA/jbpq8l0j4tF6CS0ysJxNXn+RMgBQZli5oksyJJNezeC
 FWjiqVNku2LyvZcffRo+5Spu8kcXa8A+k5OPGHStwLJ3uqU0DLEloDVmAMqsSinSRhDM
 5Z0g==
X-Gm-Message-State: APjAAAXJhq9dCb3tOH7W/7oj2DJV/DNgUQHwrN3HM1l+j3qY0XHPsZok
 oZdEu5gWlQZcU8VMfZCCCdp7WJ0j
X-Google-Smtp-Source: APXvYqzTlaywm6eWEcrlHkUZKJMXiD9B613xB3hnOHNfXjecXXwuo5fsHR3/YARbXOnUaoxUYrweVQ==
X-Received: by 2002:a65:4c06:: with SMTP id u6mr23451270pgq.412.1578950755530; 
 Mon, 13 Jan 2020 13:25:55 -0800 (PST)
Received: from [10.126.164.125] ([107.242.120.70])
 by smtp.gmail.com with ESMTPSA id s130sm14882100pgc.82.2020.01.13.13.25.54
 for <libssh2-devel@cool.haxx.se>
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Mon, 13 Jan 2020 13:25:54 -0800 (PST)
Date: Mon, 13 Jan 2020 13:25:52 -0800
User-Agent: K-9 Mail for Android
In-Reply-To: <20200113161520.30403.qmail@stuge.se>
References: <2a5aaca31006476791ad8dc8d5381742@ipaper.com>
 <A952AC6E-3C84-4FB3-A51A-F837B8A3F089@gmail.com>
 <20200113161520.30403.qmail@stuge.se>
MIME-Version: 1.0
Subject: Re: libssh2_sftp_init() hangs with zlib compression turned on
To: libssh2 development <libssh2-devel@cool.haxx.se>
From: Gebi Miguel <gebi.miguel@gmail.com>
Message-ID: <48B5523B-3DBD-47CA-9EDA-0D979DF5A771@gmail.com>
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <https://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
Content-Type: multipart/mixed; boundary="===============1314592677=="
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>

--===============1314592677==
Content-Type: multipart/alternative; boundary="----DY20OSOJAIC0G487HP1A52ZK2IWAYH"
Content-Transfer-Encoding: 7bit

------DY20OSOJAIC0G487HP1A52ZK2IWAYH
Content-Type: text/plain;
 charset=utf-8
Content-Transfer-Encoding: quoted-printable

Thank you very much for your quick response, Peter, I greatly appreciate it=
!

If the line I've added to sftp_write_nonblock=2Ec =2E=2E=2E

libssh2_trace (session, ~0);

=2E=2E=2E doesn't enable transport layer tracing, could you please let me =
know how I would go about this?
I've looked at the code some more=2E So the code example sftp_write_nonblo=
ck=2Ec is calling the function libssh2_sftp_init() (in libSSH2's sftp=2Ec) =
where libssh2_sftp_init() calls sftp_init()=2E In sftp_init() I'm getting t=
o this snippet:

if(session->sftpInit_state =3D=3D libssh2_NB_state_sent2) {
/* sent off what's left of the init buffer to send */
rc =3D _libssh2_channel_write(session->sftpInit_channel, 0,
session->sftpInit_buffer +
session->sftpInit_sent,
9 - session->sftpInit_sent);

Moving on into _libssh2_channel_write() it appears that there are nine byt=
es to send, as mentioned in the last line of the debug output "Writing 9 by=
tes on channel 0/0, stream #0"=2E In _libssh2_channel_write() I get to this=
 point:

/* drain the incoming flow first, mostly to make sure we get all
* pending window adjust packets */
do
rc =3D _libssh2_transport_read(session);
while(rc > 0);

_libssh2_transport_read() eventually calls _libssh2_recv() where things ge=
t stuck inside the call to recv()=2E The question I have is why - if there =
is no inbound data to "drain" - recv() doesn't return with SOCKET_ERROR and=
 WSAEWOULDBLOCK=2E Is the socket created in "sftp_write_nonblock=2Ec" for a=
ny purpose or any period of time used in blocking mode?

------DY20OSOJAIC0G487HP1A52ZK2IWAYH
Content-Type: text/html;
 charset=utf-8
Content-Transfer-Encoding: quoted-printable

Thank you very much for your quick response, Peter, I greatly appreciate it=
!<br><br>If the line I've added to sftp_write_nonblock=2Ec =2E=2E=2E<br><br=
>libssh2_trace (session, ~0);<br><br>=2E=2E=2E doesn't enable transport lay=
er tracing, could you please let me know how I would go about this?<br>I've=
 looked at the code some more=2E So the code example sftp_write_nonblock=2E=
c is calling the function libssh2_sftp_init() (in libSSH2's sftp=2Ec) where=
 libssh2_sftp_init() calls sftp_init()=2E In sftp_init() I'm getting to thi=
s snippet:<br><br>if(session-&gt;sftpInit_state =3D=3D libssh2_NB_state_sen=
t2) {<br>/* sent off what's left of the init buffer to send */<br>rc =3D _l=
ibssh2_channel_write(session-&gt;sftpInit_channel, 0,<br>session-&gt;sftpIn=
it_buffer +<br>session-&gt;sftpInit_sent,<br>9 - session-&gt;sftpInit_sent)=
;<br><br>Moving on into _libssh2_channel_write() it appears that there are =
nine bytes to send, as mentioned in the last line of the debug output "Writ=
ing 9 bytes on channel 0/0, stream #0"=2E In _libssh2_channel_write() I get=
 to this point:<br><br>/* drain the incoming flow first, mostly to make sur=
e we get all<br>* pending window adjust packets */<br>do<br>rc =3D _libssh2=
_transport_read(session);<br>while(rc &gt; 0);<br><br>_libssh2_transport_re=
ad() eventually calls _libssh2_recv() where things get stuck inside the cal=
l to recv()=2E The question I have is why - if there is no inbound data to =
"drain" - recv() doesn't return with SOCKET_ERROR and WSAEWOULDBLOCK=2E Is =
the socket created in "sftp_write_nonblock=2Ec" for any purpose or any peri=
od of time used in blocking mode?<br>
------DY20OSOJAIC0G487HP1A52ZK2IWAYH--

--===============1314592677==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline

X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KbGlic3NoMi1k
ZXZlbCBodHRwczovL2Nvb2wuaGF4eC5zZS9jZ2ktYmluL21haWxtYW4vbGlzdGluZm8vbGlic3No
Mi1kZXZlbAo=

--===============1314592677==--

From libssh2-devel-bounces@cool.haxx.se  Tue Jan 14 10:28:40 2020
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (mail [127.0.0.1])
	by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTP id 00E9S5vP004673;
	Tue, 14 Jan 2020 10:28:32 +0100
Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com
 [IPv6:2607:f8b0:4864:20:0:0:0:534])
 by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTPS id 00E9S0aN004517
 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Tue, 14 Jan 2020 10:28:01 +0100
Received: by mail-pg1-x534.google.com with SMTP id x8so6117925pgk.8
 for <libssh2-devel@cool.haxx.se>; Tue, 14 Jan 2020 01:28:01 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=date:user-agent:in-reply-to:references:mime-version
 :content-transfer-encoding:subject:to:from:message-id;
 bh=/AeA4k0eRwDD1UHfnG/ckWCMmurVbQX2M/zDxvumkdQ=;
 b=hJJh2see9/Qejl3Pveo5meJG7mVdNih8heHBvDb87Lm5RFoxyv3dph/B99XWHhBk9t
 w6DTUAwpcyj3H2JU0OwPtXfHdZk64lVb1AjaNfMLPrUNmLBo2puz36T1opN/scvWe1XB
 y1e1Jw7tWuaaKctaJUWMjawiln6wfulRHRHrmfoWQWgdS1qX2gq9TJqvYnCKy+RaB4ef
 FVKbyoIH8GMKUgRuzspjCnW3k9MoDtQzAVTU8NQxywkq/OjGAXSAle9n3+ifrg7Tjfn8
 su9mTYYBz4o26nK6YfwPy3+Cz0KmD9pqUUY4wIuIYeV59YlKxt1Ha7IsH99iofktUPeA
 DhRQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:date:user-agent:in-reply-to:references
 :mime-version:content-transfer-encoding:subject:to:from:message-id;
 bh=/AeA4k0eRwDD1UHfnG/ckWCMmurVbQX2M/zDxvumkdQ=;
 b=gL5I/ogmNYuIIDXSxct/ZIENseqBwpOwUfLYUGIdrCwe05HzMkdYvSSkav+p6iOyfN
 7EdwD7R7FkFrB8iQazVbyOCkcxBf3/dm5XsyRvav1YRiG7QiDlt59mlcRPqnRU+Ldq/w
 8OBNDiXBtE1JDONExsSeFeH252KlDsLwbGvCFBfVBh6ow8920wQdeN7a3a0zzOS7yLWS
 kbmG3SK73VJjr+3I9QVel7L0uIbAy2CfKpuJ/YBnvsaRN68PoL2mPAEFkKmUTCEA12jS
 eRCYnZHybduxyNxRlKs6vt/miYfGCXnqW7uDlel+o3GMr1SDgI9lsjy0gFQRid2uihuE
 KfIA==
X-Gm-Message-State: APjAAAXJDc98/MMx43MIBqAowzT83JM3Dg/y6qcSQjsP/WdaNbll2wSM
 QupfHWM0XMb3nLTGwQ+o5+tpGscg
X-Google-Smtp-Source: APXvYqxFk8USDHJLrnJmqgCgHgYE6Bl9IxzlG//785fRMQhiZlKNDXjwtWBq0E62IZYRyEGx3tNfyg==
X-Received: by 2002:a62:e411:: with SMTP id r17mr23281709pfh.119.1578994074703; 
 Tue, 14 Jan 2020 01:27:54 -0800 (PST)
Received: from Samsung-Galaxy-Halo.SpaceNet
 (c-73-42-186-179.hsd1.wa.comcast.net. [73.42.186.179])
 by smtp.gmail.com with ESMTPSA id v4sm16977091pff.174.2020.01.14.01.27.53
 for <libssh2-devel@cool.haxx.se>
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Tue, 14 Jan 2020 01:27:54 -0800 (PST)
Date: Tue, 14 Jan 2020 01:27:53 -0800
User-Agent: K-9 Mail for Android
In-Reply-To: <20200113161520.30403.qmail@stuge.se>
References: <2a5aaca31006476791ad8dc8d5381742@ipaper.com>
 <A952AC6E-3C84-4FB3-A51A-F837B8A3F089@gmail.com>
 <20200113161520.30403.qmail@stuge.se>
MIME-Version: 1.0
Subject: Re: libssh2_sftp_init() hangs with zlib compression turned on
To: libssh2 development <libssh2-devel@cool.haxx.se>
From: Gebi Miguel <gebi.miguel@gmail.com>
Message-ID: <44487029-CB4C-4606-A0C2-2B1894503E06@gmail.com>
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <https://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
Content-Type: multipart/mixed; boundary="===============0647275074=="
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>

--===============0647275074==
Content-Type: multipart/alternative; boundary="----E6MJQTFIWT68TAWX1Y733XEVHY03JJ"
Content-Transfer-Encoding: 7bit

------E6MJQTFIWT68TAWX1Y733XEVHY03JJ
Content-Type: text/plain;
 charset=utf-8
Content-Transfer-Encoding: quoted-printable

Trying to "back out" a little to maybe see the big picture I ran cmake agai=
n, first just "cmake =2E=2E" for a base line, then including zlib support t=
o compare to the base line:

cmake =2E=2E -DENABLE_ZLIB_COMPRESSION=3DON -DZLIB_LIBRARY=3D=2E=2E/=2E=2E=
/zlib-1=2E2=2E11/myBuildOrig/Debug/zlibstaticd=2Elib -DZLIB_INCLUDE_DIR=3D=
=2E=2E/=2E=2E/zlib-1=2E2=2E11

There is a difference in the cmake output that puzzles me=2E Without zlib =
support I'm seeing this:

=2E=2E=2E
-- Performing Test HAVE_IOCTLSOCKET
-- Performing Test HAVE_IOCTLSOCKET - Success
-- Looking for include file arpa/inet=2Eh
-- Looking for include file arpa/inet=2Eh - not found
=2E=2E=2E

With zlib enabled the output changes to:

-- Performing Test HAVE_IOCTLSOCKET
-- Performing Test HAVE_IOCTLSOCKET - Failed
-- Performing Test HAVE_IOCTLSOCKET_CASE
-- Performing Test HAVE_IOCTLSOCKET_CASE - Failed
-- Performing Test HAVE_SO_NONBLOCK
-- Performing Test HAVE_SO_NONBLOCK - Failed
-- Looking for include file arpa/inet=2Eh
-- Looking for include file arpa/inet=2Eh - not found

As a result, the header file libssh2_config=2Eh is different, without zlib=
 support it contains these lines:

/* Socket non-blocking support */
/* #undef HAVE_O_NONBLOCK */
/* #undef HAVE_FIONBIO */
#define HAVE_IOCTLSOCKET
/* #undef HAVE_IOCTLSOCKET_CASE */
/* #undef HAVE_SO_NONBLOCK */
/* #undef HAVE_DISABLED_NONBLOCKING */

With zlib enabled this same section in libssh2_config=2Eh changes to:

/* Socket non-blocking support */
/* #undef HAVE_O_NONBLOCK */
/* #undef HAVE_FIONBIO */
/* #undef HAVE_IOCTLSOCKET */
/* #undef HAVE_IOCTLSOCKET_CASE */
/* #undef HAVE_SO_NONBLOCK */
#define HAVE_DISABLED_NONBLOCKING

Otherwise the files are identical=2E Could that be why I'm getting stuck i=
n recv()?
------E6MJQTFIWT68TAWX1Y733XEVHY03JJ
Content-Type: text/html;
 charset=utf-8
Content-Transfer-Encoding: quoted-printable

Trying to "back out" a little to maybe see the big picture I ran cmake agai=
n, first just "cmake =2E=2E" for a base line, then including zlib support t=
o compare to the base line:<br><br>cmake =2E=2E -DENABLE_ZLIB_COMPRESSION=
=3DON -DZLIB_LIBRARY=3D=2E=2E/=2E=2E/zlib-1=2E2=2E11/myBuildOrig/Debug/zlib=
staticd=2Elib -DZLIB_INCLUDE_DIR=3D=2E=2E/=2E=2E/zlib-1=2E2=2E11<br><br>The=
re is a difference in the cmake output that puzzles me=2E Without zlib supp=
ort I'm seeing this:<br><br>=2E=2E=2E<br>-- Performing Test HAVE_IOCTLSOCKE=
T<br>-- Performing Test HAVE_IOCTLSOCKET - Success<br>-- Looking for includ=
e file arpa/inet=2Eh<br>-- Looking for include file arpa/inet=2Eh - not fou=
nd<br>=2E=2E=2E<br><br>With zlib enabled the output changes to:<br><br>-- P=
erforming Test HAVE_IOCTLSOCKET<br>-- Performing Test HAVE_IOCTLSOCKET - Fa=
iled<br>-- Performing Test HAVE_IOCTLSOCKET_CASE<br>-- Performing Test HAVE=
_IOCTLSOCKET_CASE - Failed<br>-- Performing Test HAVE_SO_NONBLOCK<br>-- Per=
forming Test HAVE_SO_NONBLOCK - Failed<br>-- Looking for include file arpa/=
inet=2Eh<br>-- Looking for include file arpa/inet=2Eh - not found<br><br>As=
 a result, the header file libssh2_config=2Eh is different, without zlib su=
pport it contains these lines:<br><br>/* Socket non-blocking support */<br>=
/* #undef HAVE_O_NONBLOCK */<br>/* #undef HAVE_FIONBIO */<br>#define HAVE_I=
OCTLSOCKET<br>/* #undef HAVE_IOCTLSOCKET_CASE */<br>/* #undef HAVE_SO_NONBL=
OCK */<br>/* #undef HAVE_DISABLED_NONBLOCKING */<br><br>With zlib enabled t=
his same section in libssh2_config=2Eh changes to:<br><br>/* Socket non-blo=
cking support */<br>/* #undef HAVE_O_NONBLOCK */<br>/* #undef HAVE_FIONBIO =
*/<br>/* #undef HAVE_IOCTLSOCKET */<br>/* #undef HAVE_IOCTLSOCKET_CASE */<b=
r>/* #undef HAVE_SO_NONBLOCK */<br>#define HAVE_DISABLED_NONBLOCKING<br><br=
>Otherwise the files are identical=2E Could that be why I'm getting stuck i=
n recv()?
------E6MJQTFIWT68TAWX1Y733XEVHY03JJ--

--===============0647275074==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline

X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KbGlic3NoMi1k
ZXZlbCBodHRwczovL2Nvb2wuaGF4eC5zZS9jZ2ktYmluL21haWxtYW4vbGlzdGluZm8vbGlic3No
Mi1kZXZlbAo=

--===============0647275074==--

From libssh2-devel-bounces@cool.haxx.se  Tue Jan 14 14:02:36 2020
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (mail [127.0.0.1])
	by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTP id 00ED27R5004236;
	Tue, 14 Jan 2020 14:02:28 +0100
Received: from foo.stuge.se (foo.stuge.se [212.116.89.98])
 by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTPS id 00ED23o9004181
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Tue, 14 Jan 2020 14:02:04 +0100
Received: (qmail 24201 invoked by uid 1000); 14 Jan 2020 13:01:59 -0000
Message-ID: <20200114130159.24200.qmail@stuge.se>
Date: Tue, 14 Jan 2020 13:01:59 +0000
From: Peter Stuge <peter@stuge.se>
To: libssh2-devel@cool.haxx.se
Subject: Re: libssh2_sftp_init() hangs with zlib compression turned on
References: <2a5aaca31006476791ad8dc8d5381742@ipaper.com>
 <A952AC6E-3C84-4FB3-A51A-F837B8A3F089@gmail.com>
 <20200113161520.30403.qmail@stuge.se>
 <44487029-CB4C-4606-A0C2-2B1894503E06@gmail.com>
MIME-Version: 1.0
Content-Disposition: inline
In-Reply-To: <44487029-CB4C-4606-A0C2-2B1894503E06@gmail.com>
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <https://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
Content-Type: text/plain; charset="utf-8"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id 00ED27R5004236

Gebi Miguel wrote:
> As a result, the header file libssh2_config.h is different,

Wow - good find!


> With zlib enabled this same section in libssh2_config.h changes to:
..
> #define HAVE_DISABLED_NONBLOCKING
> 
> Otherwise the files are identical. Could that be why I'm getting stuck
> in recv()?

Yes, that's quite possible.

IIRC libssh2 expects to be able to use nonblocking IO internally, if
that's not available then things may stop unexpectedly.


I don't like to use cmake, the people who have contributed that
support would have to help you fix this, it seems like a bug to me.

I've written part of the autotools/configure in libssh2 and am happy
to help you with that if it has the same issue (which I doubt) but to
get binaries for Windows that would require either a small bash
environment like MSYS or cross-compilation, both probably using gcc.

Another option still may be to hand-write an Nmakefile, libssh2 is a
fairly straightforward library.

But it may also be sufficient to copy the non-blocking section of
libssh2_priv.h from the non-zlib case into the file when configured
with zlib.


//Peter
_______________________________________________
libssh2-devel https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Tue Jan 14 20:10:50 2020
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (mail [127.0.0.1])
	by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTP id 00EJAHdV029995;
	Tue, 14 Jan 2020 20:10:39 +0100
Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com
 [IPv6:2607:f8b0:4864:20:0:0:0:42c])
 by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTPS id 00EJAEkV029905
 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Tue, 14 Jan 2020 20:10:14 +0100
Received: by mail-pf1-x42c.google.com with SMTP id z16so7039772pfk.0
 for <libssh2-devel@cool.haxx.se>; Tue, 14 Jan 2020 11:10:15 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=date:user-agent:in-reply-to:references:mime-version
 :content-transfer-encoding:subject:to:from:message-id;
 bh=zJd7c30MYUnx7K0ZA8L31J6FvI1IWRaz+KxXNeRkyjo=;
 b=khosGdtRdyuoWZAOWAxp7u/8MWY91mRj5SCeOy/JkmXihRxs0dLeTJrpaDT0aL/juh
 wNWT3wprhQl0dTsj6FdKtHDtqj63Z9QfKIFXzJCURvL1+M3D8iuU6lV6gZcvwurR5PEH
 jsOjjXbI4yeWhopgDkQP50pOq4NdCGQn3N/EkK695jqpnFb4OS9dho9tjdOHXUYgBN28
 SdBQWm+yzPpf2tKopvgdIizRd0djH55l9uP3GYL1E8NQixe/HTpD4HeZpoQDSFFlG7GM
 aDQ2GrWBSooRLNwdqxftqvF2+0HmMJdwgu9sAbP+Y3BAtjbz5yF1+1i4eFjCApocQ5D+
 wkPw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:date:user-agent:in-reply-to:references
 :mime-version:content-transfer-encoding:subject:to:from:message-id;
 bh=zJd7c30MYUnx7K0ZA8L31J6FvI1IWRaz+KxXNeRkyjo=;
 b=pcJGfZCtzCzdAun8mQbvFeh910qXmod8IF7tlPR3Iqalvc0CXcS84rqOHpcJsjWQe+
 OIuj3xjHnmnuM8Pcz/sf0nd8T13GYhAnwI24qHc41UYJTMMQ0v2dkixHWJt4aU4p4XX5
 0Vk1DWQjj+4oS/8bwNV/eKEdip/p1q0cZszuoJWS4z4CkWsOP0rmv5WxeGZLFvcS1Vzt
 PLwckJjt4eRkteebRQdF1xDJHfS4r+Pe/0QiBHkwttAQWNq0NHsf5H0ca8qjcfS7Gqhe
 vGJUo4QrRy5hDELSodT+owLWr6IQvfk72Gd+xaA3E5EPBq2HXF9YSDZiQXRYKy71IDgY
 Y2pQ==
X-Gm-Message-State: APjAAAVBUNfG2ziCJox1QO/P5d0w2cuE/Kz6ZbJag/Y96CTOfHb9kj0i
 s0lbg353f2qr44/srVX2azGAbmtR
X-Google-Smtp-Source: APXvYqyZblh+o9yEdMM6RfYVCeUHqehfZqUybKt5PdFjlYeKcTh7ZekgV6agxuf7WsFHDUKcDKXjKQ==
X-Received: by 2002:a62:f207:: with SMTP id m7mr27474030pfh.223.1579029009024; 
 Tue, 14 Jan 2020 11:10:09 -0800 (PST)
Received: from Samsung-Galaxy-Halo.SpaceNet
 (c-73-42-186-179.hsd1.wa.comcast.net. [73.42.186.179])
 by smtp.gmail.com with ESMTPSA id s185sm19577556pfc.35.2020.01.14.11.10.07
 for <libssh2-devel@cool.haxx.se>
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Tue, 14 Jan 2020 11:10:08 -0800 (PST)
Date: Tue, 14 Jan 2020 11:10:05 -0800
User-Agent: K-9 Mail for Android
In-Reply-To: <20200114130159.24200.qmail@stuge.se>
References: <2a5aaca31006476791ad8dc8d5381742@ipaper.com>
 <A952AC6E-3C84-4FB3-A51A-F837B8A3F089@gmail.com>
 <20200113161520.30403.qmail@stuge.se>
 <44487029-CB4C-4606-A0C2-2B1894503E06@gmail.com>
 <20200114130159.24200.qmail@stuge.se>
MIME-Version: 1.0
Subject: Re: libssh2_sftp_init() hangs with zlib compression turned on
To: libssh2 development <libssh2-devel@cool.haxx.se>
From: Gebi Miguel <gebi.miguel@gmail.com>
Message-ID: <EB5546AF-85A0-4C71-BD83-6F3C2DFBCC10@gmail.com>
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <https://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
Content-Type: multipart/mixed; boundary="===============0094113658=="
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>

--===============0094113658==
Content-Type: multipart/alternative; boundary="----0XGT5EWZLILPSO7W54MKTXJ27SLTFN"
Content-Transfer-Encoding: 7bit

------0XGT5EWZLILPSO7W54MKTXJ27SLTFN
Content-Type: text/plain;
 charset=utf-8
Content-Transfer-Encoding: quoted-printable

So I've copied the file libssh2_config=2Eh from a build without zlib and su=
ccessfully compiled it all=2E  To make sftp_write_nonblock=2Ec attempt to u=
se zlib I had to add another line of code early on =2E=2E=2E

libssh2_session_flag (session, LIBSSH2_FLAG_COMPRESS, 1);

=2E=2E=2E and try with a server that supports compression (RebexTinySftpSe=
rver=2Eexe doesn't but then again, that's not its claim to fame, so this is=
 not a complaint in the least) so the function kex_agree_comp() succeeds=2E

Thanks again for your response, Peter, you have helped me get where I need=
 to be!
If there is anyone that feels like taking on the cmake issue that made non=
-blocking sockets unavailable to libSSH2 with zlib, please respond=2E  I'll=
 happily try and test and help in any way I can!

------0XGT5EWZLILPSO7W54MKTXJ27SLTFN
Content-Type: text/html;
 charset=utf-8
Content-Transfer-Encoding: quoted-printable

So I've copied the file libssh2_config=2Eh from a build without zlib and su=
ccessfully compiled it all=2E  To make sftp_write_nonblock=2Ec attempt to u=
se zlib I had to add another line of code early on =2E=2E=2E<br><br>libssh2=
_session_flag (session, LIBSSH2_FLAG_COMPRESS, 1);<br><br>=2E=2E=2E and try=
 with a server that supports compression (RebexTinySftpServer=2Eexe doesn't=
 but then again, that's not its claim to fame, so this is not a complaint i=
n the least) so the function kex_agree_comp() succeeds=2E<br><br>Thanks aga=
in for your response, Peter, you have helped me get where I need to be!<br>=
If there is anyone that feels like taking on the cmake issue that made non-=
blocking sockets unavailable to libSSH2 with zlib, please respond=2E  I'll =
happily try and test and help in any way I can!<br>
------0XGT5EWZLILPSO7W54MKTXJ27SLTFN--

--===============0094113658==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline

X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KbGlic3NoMi1k
ZXZlbCBodHRwczovL2Nvb2wuaGF4eC5zZS9jZ2ktYmluL21haWxtYW4vbGlzdGluZm8vbGlic3No
Mi1kZXZlbAo=

--===============0094113658==--

