www.libssh2.org | Daily snapshots | Mailing list archive | Docs | Examples | github

Archive Index This month's Index

Subject: libssh2 through squid3

libssh2 through squid3

From: Erwin Brandenberger <erwin.brandenberger_at_heag.ch>
Date: Mon, 03 Nov 2014 16:27:11 +0100

I like to connect to a SFTP server through a squid3 proxy

A test with filezilla seams to work.

With my test binary I have troubles. At the handshake I get a -2 as error
  known as LIBSSH2_ERROR_BANNER_RECV.

My code looks like

error = libssh2_init (0);
...
error = mTCP->Bind(ownip, mPort);
...
error = mTCP->Connect(mProxyIp, mProxyPort);
...
error = ProxyConnectCommand(mTCP, ip, port, mProxyUser, mProxyPassword);
/* HTTP CONNECT method */
...
mSession = libssh2_session_init();
...
/* Since we have set non-blocking, tell libssh2 we are blocking */
libssh2_session_set_blocking((LIBSSH2_SESSION *)mSession, 1);

error = libssh2_session_banner_set((LIBSSH2_SESSION *)mSession, "SFTP
Client\r\n");
...

#if LIBSSH2_VERSION_NUM >= 0x010208
/* correct method since libssl 1.2.8 */
error = libssh2_session_handshake((LIBSSH2_SESSION *)mSession,
mTCP->GetSocket());
#else
#endif

At this last libssh2_session_handshake call I get the -2 error code:

My Log looks like:

RWSftpCronThread.cpp(161) 31/10 14:19:30(23)=FTP Client Bind to c0a80d50/0
RWSftpCronThread.cpp(161) 31/10 14:19:30(23)=FTP Client Connect to proxy
c0a80d58/3128
RWSftpCronThread.cpp(161) 31/10 14:19:30(23)=FTP Client [Send Proxy
Connect]:CONNECT xxx.xxx.xxx.xxx:22 HTTP/1.0
Proxy-authorization: Basic ZXJ3aW46Z29nb2dvMQ==

RWSftpCronThread.cpp(161) 31/10 14:19:30(23)=FTP Client [Wait for Proxy
Connect Reply]:CONNECT xxx.xxx.xxx.xxx:22 HTTP/1.0
Proxy-authorization: Basic ZXJ3aW46Z29nb2dvMQ==

RWSftpCronThread.cpp(161) 31/10 14:19:30(23)=FTP Client [Proxy Reply
(200=OK, 401=NeedAuth)]:HTTP/1.1 200 Connection established

RWSftpCronThread.cpp(161) 31/10 14:19:30(23)=FTP Client Initialize ssh
session
RWSftpCronThread.cpp(170) 31/10 14:19:30(13)=FTP Client ErrorTcpBase -
Code: -2, Msg: Failure establishing SFTP session

Any hint ?

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2014-11-03

the libssh2 team