Package: x2goclient
Version: 4.0.5.0-0

When trying to connect to a session using HTTP proxy, it fails the first time with the below message in an error dialog.

"Socket error: disconnected"

When connecting to the same session the second time within 30 secs, the connection goes through and I am logged into my virtual desktop. I am able to replicate this issue several times.

Below is the output of the client running in debug mode (with the above scenario captured) -

==========

x2go-INFO-8> "Starting connection to server: desktop.a1200.virtualorgs.net:80"
x2go-DEBUG-../src/onmainwindow.cpp:2758> Starting new ssh connection to server:"desktop.a1200.virtualorgs.net":"80" krbLogin: false
x2go-DEBUG-../src/sshmasterconnection.cpp:168> SshMasterConnection, host "desktop.a1200.virtualorgs.net"port 80user "superuser"useproxy trueproxyserver "desktop.a1200.virtualorgs.net"proxyport 80
x2go-DEBUG-../src/sshmasterconnection.cpp:205> Starting SSH connection without Kerberos authentication.
x2go-DEBUG-../src/sshmasterconnection.cpp:209> SshMasterConnection, instance SshMasterConnection(0x10d8030)  created.
x2go-DEBUG-../src/sshmasterconnection.cpp:445> SshMasterConnection, instance SshMasterConnection(0x10d8030)  entering thread.
x2go-DEBUG-../src/sshmasterconnection.cpp:481> libssh not initialized yet. Initializing.
x2go-DEBUG-../src/sshmasterconnection.cpp:559> Created HTTP proxy socket: -1

x2go-DEBUG-../src/sshmasterconnection.cpp:564> Connected to HTTP proxy server: "desktop.a1200.virtualorgs.net":80

x2go-DEBUG-../src/sshmasterconnection.cpp:581> "Cannot connect to desktop.a1200.virtualorgs.net:80" - "Socket error: disconnected"
x2go-ERROR-2> "Connection error: Cannot connect to desktop.a1200.virtualorgs.net:80: Socket error: disconnected"
x2go-DEBUG-../src/sshmasterconnection.cpp:711> SshMasterConnection, instance SshMasterConnection(0x10d8030)  waiting for thread to finish.
x2go-DEBUG-../src/sshmasterconnection.cpp:715> SshMasterConnection, instance SshMasterConnection(0x10d8030)  thread finished.
x2go-DEBUG-../src/sshmasterconnection.cpp:722> SshMasterConnection, instance SshMasterConnection(0x10d8030)  finished destructor.
x2go-INFO-8> "Starting connection to server: desktop.a1200.virtualorgs.net:80"
x2go-DEBUG-../src/onmainwindow.cpp:2758> Starting new ssh connection to server:"desktop.a1200.virtualorgs.net":"80" krbLogin: false
x2go-DEBUG-../src/sshmasterconnection.cpp:168> SshMasterConnection, host "desktop.a1200.virtualorgs.net"port 80user "superuser"useproxy trueproxyserver "desktop.a1200.virtualorgs.net"proxyport 80
x2go-DEBUG-../src/sshmasterconnection.cpp:205> Starting SSH connection without Kerberos authentication.
x2go-DEBUG-../src/sshmasterconnection.cpp:209> SshMasterConnection, instance SshMasterConnection(0x10d3580)  created.
x2go-DEBUG-../src/sshmasterconnection.cpp:445> SshMasterConnection, instance SshMasterConnection(0x10d3580)  entering thread.
x2go-DEBUG-../src/sshmasterconnection.cpp:498> libssh already initialized.
x2go-DEBUG-../src/sshmasterconnection.cpp:559> Created HTTP proxy socket: 13

x2go-DEBUG-../src/sshmasterconnection.cpp:564> Connected to HTTP proxy server: "desktop.a1200.virtualorgs.net":80

x2go-DEBUG-../src/sshmasterconnection.cpp:792> cserverAuth
x2go-DEBUG-../src/sshmasterconnection.cpp:807> state: 1

x2go-DEBUG-../src/sshmasterconnection.cpp:966> Password authentication requested.

x2go-DEBUG-../src/sshmasterconnection.cpp:657> User authentication OK.
x2go-DEBUG-../src/onmainwindow.cpp:2853> SSH connection established.
x2go-DEBUG-../src/onmainwindow.cpp:3120> Continue normal X2Go session

==========

I am able to connect on the first try with the same HTTP proxy server settings using Putty and even NoMachine v3.5. But for X2GO, it's always on the second try.

I am currently using X2GO 4.0.5.0-0x2go1+git20160126.1112+jessie.main.1, Debian GNU/Linux 8, libssh4-0.6.3-4+deb8u1, libc6-2.19-18+deb8u1.

Also, I can replicate this issue on Debian 8 - v4.0.3.1-4 and Windows 7 - v4.0.5.0.

Any help here would be greatly appreciated.

Thanks,
Nimesh