My SFTP installation is used to fetch files from a specific SFTP server. It has been working fine for many months and now suddenly it is failing. I suspect that my company has upgraded their SFTP server.
Some shorter files (about 78k bytes) work fine, but when it attempts to download a 36Mbyte file it fails with -31 (LIBSSH2_ERROR_SFTP_PROTOCOL). Oddly enough, it fails in the first call to libssh2_sftp_read() (with a buffer of 40,000 bytes), so I'm not sure what the length of the file has to do with anything. I can use filezilla to successfully download the files using SFTP, so I'm not sure if this is a problem with their server or libssh2. I've done a run with debug tracing on and I've attached the output. Unfortunately, I'm not sure what I'm looking at, except for the bit at the end where it receives this from the server: 0000: 5E 00 00 00 00 00 00 00 2D 00 00 00 29 65 00 00 : ^.......-...)e.. 0010: 00 02 00 00 00 04 00 00 00 16 49 6E 74 65 72 6E : ..........Intern 0020: 61 6C 20 73 65 72 76 65 72 20 65 72 72 6F 72 2E : al server error. 0030: 00 00 00 02 65 6E : ....en I've tried it with wincng and openssl and both fail and I've tried a buffer size of 2000 bytes instead of 40000. I've found in the past that I NEED to specify a buffer that is an exact multiple of 2000 bytes for it to work with this SFTP server. If anyone has any ideas on how to proceed, I'd greatly appreciate it. Thanks, Bob Kast
[libssh2] 536.060738 Conn: Writing 29 bytes on channel 0/1, stream #0 [libssh2] 536.060738 Conn: Sending 29 bytes on channel 0/1, stream_id=0 => libssh2_transport_write plain (9 bytes) 0000: 5E 00 00 00 01 00 00 00 1D : ^........ => libssh2_transport_write plain2 (29 bytes) 0000: 00 00 00 19 05 00 00 00 02 00 00 00 04 00 00 00 : ................ 0010: 01 00 00 00 00 00 00 00 00 00 00 07 D0 : ............Ð [libssh2] 536.060738 Socket: Sent 308/308 bytes at 0000000004981268 => libssh2_transport_write send() (308 bytes) 0000: E1 9F 88 5D CA B9 89 49 58 55 DA FB B4 41 0D 47 : á.]ʹIXUÚû´A.G 0010: 32 B6 F9 F0 6C 3B CA 31 4A 0A C1 98 A9 D4 6E F5 : 2¶ùðl;Ê1J.Á.©Ônõ 0020: C4 41 0B 6C D3 52 ED AC 4D 1E 78 DA 81 0D 61 B7 : ÄA.lÓRí¬M.xÚ..a· 0030: 83 C7 63 F6 30 C1 68 C4 06 19 54 A6 E3 FD 7B FC : Çcö0ÁhÄ..T¦ãý{ü 0040: E5 5F 11 DB 84 17 50 CF 90 36 A6 04 B0 6F A6 ED : å_.Û.PÏ.6¦.°o¦í 0050: 37 71 DC 0A EA 8F 85 C4 8A 94 4D 61 5E 30 13 2A : 7qÜ.ê. ÄMa^0.* 0060: E7 59 61 5C 13 E8 62 24 A7 5A 45 2C 92 01 70 A5 : çYa\.èb$§ZE,.p¥ 0070: B5 25 0C FC B0 35 8A 66 EE 67 22 82 EF DD 9A EB : µ%.ü°5fîg"ïÝë 0080: 25 BA E8 E2 8B 6D F0 10 0C 7B 5F 80 4F D9 7C 12 : %ºèâmð..{_.OÙ|. 0090: FA CF 5F 25 6A C0 02 68 E2 FC BF 21 CF 91 E5 77 : úÏ_%jÀ.hâü¿!Ïåw 00a0: CA 5B 09 AC E0 C5 AC 86 07 46 94 BB 54 0D A7 23 : Ê[ ¬àŬ.F»T.§# 00b0: 4E 73 7E 91 D5 DD D1 6A 4B 11 2B 25 3B E9 EA E7 : Ns~ÕÝÑjK.+%;éêç 00c0: 7B 66 1F 12 FE F5 9D 2C 51 FB E4 47 E7 76 43 BC : {f..þõ.,QûäGçvC¼ 00d0: 5C B5 B3 69 9E A0 A5 3C 53 FE AA AA 3E C2 FB 21 : \µ³i ¥<Sþªª>Âû! 00e0: 65 BD 5F A9 50 8F 96 39 3A AF DF A2 F2 32 36 5B : e½_©P.9:¯ß¢ò26[ 00f0: 4D 71 22 56 48 8C 26 F7 39 0B E8 7F C9 7F AA 27 : Mq"VH&÷9.è.É.ª' 0100: 31 35 BE 5D BA FA DC C0 9B 08 57 61 B6 A8 88 88 : 15¾]ºúÜÀ.Wa¶¨.. 0110: A5 BE 66 77 7E 6A 59 C8 94 54 86 11 08 28 5E 75 : ¥¾fw~jYÈT..(^u 0120: 31 98 63 AA C1 C8 CF 25 B5 DC 8F 2D BD D9 6E 36 : 1.cªÁÈÏ%µÜ.-½Ùn6 0130: 77 2D 67 B6 : w-g¶ [libssh2] 536.076363 Conn: Writing 29 bytes on channel 0/1, stream #0 [libssh2] 536.076363 Conn: Sending 29 bytes on channel 0/1, stream_id=0 => libssh2_transport_write plain (9 bytes) 0000: 5E 00 00 00 01 00 00 00 1D : ^........ => libssh2_transport_write plain2 (29 bytes) 0000: 00 00 00 19 05 00 00 00 03 00 00 00 04 00 00 00 : ................ 0010: 01 00 00 00 00 00 00 07 D0 00 00 07 D0 : ........Ð...Ð [libssh2] 536.076363 Socket: Sent 308/308 bytes at 0000000004981268 => libssh2_transport_write send() (308 bytes) 0000: 0A 67 0D 9B 7E BC E1 40 3E 09 F4 BC 76 5C 1F C6 : .g.~¼á@> ô¼v\.Æ 0010: 6F 8D 56 05 FC 2A E7 7A AB 14 79 18 25 2D 42 99 : o.V.ü*çz«.y.%-B. 0020: 85 7C 39 61 21 FA DF DE A8 93 D4 91 89 53 25 54 : |9a!úßÞ¨ÔS%T 0030: 65 B5 FB 56 74 7B 4D F5 10 30 66 F5 EA DF E3 F9 : eµûVt{Mõ.0fõêßãù 0040: 93 AA 60 C2 25 15 F4 E7 79 AC 2D BF B2 D0 87 92 : ª`Â%.ôçy¬-¿²Ð 0050: 30 7B 1F 52 A6 27 FC EB 9A 65 21 EA B1 C3 E6 FA : 0{.R¦'üëe!ê±Ãæú 0060: 99 9D 4D 89 51 DA 33 8B 6B 64 01 2F 98 20 7C 2E : ..MQÚ3kd./. |. 0070: 6A FF 12 3B CE 20 BA 2C 73 99 7B B7 D6 E0 29 D8 : jÿ.;Î º,s.{·Öà)Ø 0080: 11 33 8C 9D C1 81 18 28 0F D4 48 10 7F D8 8A A0 : .3.Á..(.ÔH..Ø 0090: CD F5 CA 61 07 57 F5 B3 82 0A 01 BD 2B 40 B1 7B : ÍõÊa.Wõ³..½+@±{ 00a0: 9A A6 59 60 76 57 25 22 8A 51 BB 47 EE F6 8B 6E : ¦Y`vW%"Q»Gîön 00b0: 73 DA 2B F5 F2 27 FA C9 CF 97 4F 20 01 09 8E 5E : sÚ+õò'úÉÏO . ^ 00c0: D2 AC C8 F5 9D BC CF 1D EF 11 20 2E D5 85 F0 29 : Ò¬Èõ.¼Ï.ï. .Õ ð) 00d0: E8 5D A4 DC 36 68 AE 9C C2 12 74 5F F7 9E 1D E2 : è]¤Ü6h®Â.t_÷.â 00e0: 63 3D 66 D3 C0 C7 63 7A C7 BB F3 82 42 B8 2A 34 : c=fÓÀÇczÇ»óB¸*4 00f0: 41 5F 70 37 75 51 89 BC 9F 80 DC 7E 3A 8A FA 97 : A_p7uQ¼.Ü~:ú 0100: 25 70 2B 01 CC BA E9 F7 1A 46 B9 06 6D B6 7B BD : %p+.̺é÷.F¹.m¶{½ 0110: 67 52 9F B8 6E 63 67 48 FF F6 BB 30 3B AF 83 DB : gR¸ncgHÿö»0;¯Û 0120: CA FD 1B 7F E3 22 54 B8 D7 D2 00 EA EB D9 A5 30 : Êý..ã"T¸×Ò.êëÙ¥0 0130: 04 25 A4 60 : .%¤` [libssh2] 536.091988 Conn: Writing 29 bytes on channel 0/1, stream #0 [libssh2] 536.091988 Conn: Sending 29 bytes on channel 0/1, stream_id=0 => libssh2_transport_write plain (9 bytes) 0000: 5E 00 00 00 01 00 00 00 1D : ^........ => libssh2_transport_write plain2 (29 bytes) 0000: 00 00 00 19 05 00 00 00 04 00 00 00 04 00 00 00 : ................ 0010: 01 00 00 00 00 00 00 0F A0 00 00 07 D0 : ........ ...Ð [libssh2] 536.091988 Socket: Sent 308/308 bytes at 0000000004981268 => libssh2_transport_write send() (308 bytes) 0000: B5 13 AD 7F F4 C6 5B 7C A7 AF 56 16 17 9B 32 1A : µ..ôÆ[|§¯V..2. 0010: 2D DA 7F F0 88 BA 2F D9 5B 6F 99 52 5E 1E A8 11 : -Ú.ð.º/Ù[o.R^.¨. 0020: EB 16 DD B3 C7 34 5D 2B F6 60 99 43 31 40 25 92 : ë.ݳÇ4]+ö`.C1@% 0030: BB 93 6E 58 B7 30 A2 07 72 1A 2D D0 03 26 0B DF : »nX·0¢.r.-Ð.&.ß 0040: DC 2B 44 0F 32 99 D7 54 7A 0A 7C 65 10 E1 21 61 : Ü+D.2.×Tz.|e.á!a 0050: 56 B7 2B 4E CD 63 6B 05 44 97 12 54 27 E9 36 01 : V·+NÍck.D.T'é6. 0060: 61 6B 66 36 A3 FD 93 29 F1 9E 27 8B 68 01 87 F6 : akf6£ý)ñ'h.ö 0070: CA BA 62 75 97 8A 6A C5 49 AE BB 0C 27 8B BB C0 : ʺbujÅI®».'»À 0080: 89 96 D4 50 D3 44 04 88 7C 43 BE 71 F0 84 24 92 : ÔPÓD..|C¾qð$ 0090: 9D F4 56 76 63 62 D6 B5 B3 70 BA B7 2C 1D 95 A9 : .ôVvcbÖµ³pº·,.© 00a0: 3E EA 87 D8 65 72 AC AA 97 5C EF FA EC 35 A5 8E : >êØer¬ª\ïúì5¥ 00b0: A2 C1 74 56 5F 71 8A 49 C0 49 66 8B 02 B8 42 13 : ¢ÁtV_qIÀIf.¸B. 00c0: A3 65 DA 65 52 9D 1F 52 A6 FE 0D EB CD 8C 7A 94 : £eÚeR..R¦þ.ëÍz 00d0: 01 0B 14 99 A0 C4 86 66 4D 19 3D 4E 14 88 61 2B : .... ÄfM.=N..a+ 00e0: 7A 6D 7C 6C E9 F7 B0 81 A0 07 2D CB 63 E3 36 5C : zm|lé÷°. .-Ëcã6\ 00f0: C6 60 15 A1 D9 E2 19 4A D4 F0 B5 CA 64 04 F3 47 : Æ`.¡Ùâ.JÔðµÊd.óG 0100: 20 11 F8 1B AD 7B 77 E0 FB 11 F1 67 60 86 ED 1B : .ø.{wàû.ñg`í. 0110: 29 9E 25 D7 8F DB 17 E1 43 A3 53 5F C3 68 34 CE : )%×.Û.áC£S_Ãh4Î 0120: E6 7D 85 19 FF CB B4 88 52 0A 55 36 F1 D0 61 8C : æ} .ÿË´.R.U6ñÐa 0130: 6A 87 6C A4 : jl¤ [libssh2] 536.091988 Conn: Writing 29 bytes on channel 0/1, stream #0 [libssh2] 536.091988 Socket: Recved 84/16384 bytes to 000000000497D228+0 => libssh2_transport_read() raw (84 bytes) 0000: 3C 97 FE CD BB B2 77 F4 BE D0 86 A2 65 0A EB 98 : <þÍ»²wô¾Ð¢e.ë. 0010: 2C 55 03 30 08 C2 6E D2 C5 B6 8E 4D 5E 94 46 B6 : ,U.0.ÂnÒŶM^F¶ 0020: CC 2A B1 9A 1B 49 F5 1B C9 C0 CE 0D DE 0E 57 81 : Ì*±.Iõ.ÉÀÎ.Þ.W. 0030: BB F4 0D 8B 15 08 6B 94 FF 39 63 7C 81 25 96 FF : »ô...kÿ9c|.%ÿ 0040: 54 B8 46 1B AF 66 1A F3 E7 FD C4 28 37 84 8F 2D : T¸F.¯f.óçýÄ(7.- 0050: 60 BC 84 00 : `¼. => libssh2_transport_read() plain (54 bytes) 0000: 5E 00 00 00 00 00 00 00 2D 00 00 00 29 65 00 00 : ^.......-...)e.. 0010: 00 02 00 00 00 04 00 00 00 16 49 6E 74 65 72 6E : ..........Intern 0020: 61 6C 20 73 65 72 76 65 72 20 65 72 72 6F 72 2E : al server error. 0030: 00 00 00 02 65 6E : ....en [libssh2] 536.107612 Transport: Packet type 94 received, length=54 [libssh2] 536.107612 Conn: 45 bytes packet_add() for 0/1/0 [libssh2] 536.107612 Conn: increasing read_avail by 45 bytes to 45/2097093 [libssh2] 536.107612 Conn: Sending 29 bytes on channel 0/1, stream_id=0 => libssh2_transport_write plain (9 bytes) 0000: 5E 00 00 00 01 00 00 00 1D : ^........ => libssh2_transport_write plain2 (29 bytes) 0000: 00 00 00 19 05 00 00 00 05 00 00 00 04 00 00 00 : ................ 0010: 01 00 00 00 00 00 00 17 70 00 00 07 D0 : ........p...Ð
_______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel