cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re-using easy handles in a multi interface loop with SFTP

From: Andreas Wurf <awurf_at_adobe.com>
Date: Fri, 17 Oct 2008 13:26:03 +0100

Hi all,

Just another question regarding SFTP: Transferring a bunch of files using the multi interface via FTP-protocol perfectly re-uses the existing easy handles (In this example, I only have one easy handle in my multi handle, though). If I just switch from FTP to SFTP, connection re-using seems to be gone. Please see the example log output for two consecutive transfers below:

STATE: INIT => CONNECT handle 0x1349520; (connection #-5000)
STATE: CONNECT => WAITRESOLVE handle 0x1349520; (connection #0)
About to connect() to foo.bar.com port 22 (#0)
  Trying 1.2.3.4... STATE: WAITRESOLVE => WAITCONNECT handle 0x1349520; (connection #0)
Connected to foo.bar.com (1.2.3.4) port 22 (#0)
User: user
Password: password
SSH socket: 10988
SFTP 0x133db08 state change from SSH_STOP to SSH_S_STARTUP
Fingerprint: A1 01 98 6D 03 58 7E C4 BF 3D 98 E1 DC 63 5F 71
SFTP 0x133db08 state change from SSH_S_STARTUP to SSH_AUTHLIST
STATE: WAITCONNECT => PROTOCONNECT handle 0x1349520; (connection #0)
SSH authentication methods available: publickey,password
SFTP 0x133db08 state change from SSH_AUTHLIST to SSH_AUTH_PKEY_INIT
SFTP 0x133db08 state change from SSH_AUTH_PKEY_INIT to SSH_AUTH_PASS_INIT
SFTP 0x133db08 state change from SSH_AUTH_PASS_INIT to SSH_AUTH_PASS
Initialized password authentication
SFTP 0x133db08 state change from SSH_AUTH_PASS to SSH_AUTH_DONE
Authentication complete
SFTP 0x133db08 state change from SSH_AUTH_DONE to SSH_SFTP_INIT
SFTP 0x133db08 state change from SSH_SFTP_INIT to SSH_SFTP_REALPATH
SSH CONNECT phase done
SFTP 0x133db08 state change from SSH_SFTP_REALPATH to SSH_STOP
STATE: PROTOCONNECT => DO handle 0x1349520; (connection #0)
DO phase starts
SFTP 0x133db08 state change from SSH_STOP to SSH_SFTP_QUOTE_INIT
SFTP 0x133db08 state change from SSH_SFTP_QUOTE_INIT to SSH_SFTP_TRANS_INIT
STATE: DO => DOING handle 0x1349520; (connection #0)
SFTP 0x133db08 state change from SSH_SFTP_TRANS_INIT to SSH_SFTP_UPLOAD_INIT
SFTP 0x133db08 state change from SSH_SFTP_UPLOAD_INIT to SSH_STOP
DO phase is complete
STATE: DOING => DO_DONE handle 0x1349520; (connection #0)
STATE: DO_DONE => WAITPERFORM handle 0x1349520; (connection #0)
Conn 0 recv pipe 1 inuse 0 athead 1
STATE: WAITPERFORM => PERFORM handle 0x1349520; (connection #0)
Opening file d:\test\test1.dat
Closing file d:\test\test1.dat
STATE: PERFORM => DONE handle 0x1349520; (connection #0)
Expire cleared
SFTP 0x133db08 state change from SSH_STOP to SSH_SFTP_CLOSE
Connection #0 to host foo.bar.com left intact
STATE: DONE => COMPLETED handle 0x1349520; (connection #-5000)

STATE: INIT => CONNECT handle 0x1349480; (connection #-5000)
Connection #0 seems to be dead!
Expire cleared
SSH DISCONNECT starts now
SFTP 0x133db08 state change from SSH_SFTP_CLOSE to SSH_SFTP_SHUTDOWN
SFTP 0x133db08 state change from SSH_SFTP_SHUTDOWN to SSH_SESSION_DISCONNECT
SFTP 0x133db08 state change from SSH_SESSION_DISCONNECT to SSH_SESSION_FREE
SFTP 0x133db08 state change from SSH_SESSION_FREE to SSH_STOP
SSH DISCONNECT is done
Closing connection #0
About to connect() to foo.bar.com port 22 (#0)
  Trying 1.2.3.4... STATE: CONNECT => WAITCONNECT handle 0x1349480; (connection #0)
Connected to foo.bar.com (1.2.3.4) port 22 (#0)
User: user
Password: password
SSH socket: 10988
SFTP 0x134c348 state change from SSH_STOP to SSH_S_STARTUP
Fingerprint: A1 01 98 6D 03 58 7E C4 BF 3D 98 E1 DC 63 5F 71
SFTP 0x134c348 state change from SSH_S_STARTUP to SSH_AUTHLIST
STATE: WAITCONNECT => PROTOCONNECT handle 0x1349480; (connection #0)
SSH authentication methods available: publickey,password
SFTP 0x134c348 state change from SSH_AUTHLIST to SSH_AUTH_PKEY_INIT
SFTP 0x134c348 state change from SSH_AUTH_PKEY_INIT to SSH_AUTH_PASS_INIT
SFTP 0x134c348 state change from SSH_AUTH_PASS_INIT to SSH_AUTH_PASS
Initialized password authentication
SFTP 0x134c348 state change from SSH_AUTH_PASS to SSH_AUTH_DONE
Authentication complete
SFTP 0x134c348 state change from SSH_AUTH_DONE to SSH_SFTP_INIT
SFTP 0x134c348 state change from SSH_SFTP_INIT to SSH_SFTP_REALPATH
SSH CONNECT phase done
SFTP 0x134c348 state change from SSH_SFTP_REALPATH to SSH_STOP
STATE: PROTOCONNECT => DO handle 0x1349480; (connection #0)
DO phase starts
SFTP 0x134c348 state change from SSH_STOP to SSH_SFTP_QUOTE_INIT
SFTP 0x134c348 state change from SSH_SFTP_QUOTE_INIT to SSH_SFTP_TRANS_INIT
STATE: DO => DOING handle 0x1349480; (connection #0)
SFTP 0x134c348 state change from SSH_SFTP_TRANS_INIT to SSH_SFTP_UPLOAD_INIT
SFTP 0x134c348 state change from SSH_SFTP_UPLOAD_INIT to SSH_STOP
DO phase is complete
STATE: DOING => DO_DONE handle 0x1349480; (connection #0)
STATE: DO_DONE => WAITPERFORM handle 0x1349480; (connection #0)
Conn 0 recv pipe 1 inuse 0 athead 1
STATE: WAITPERFORM => PERFORM handle 0x1349480; (connection #0)
Opening file d:\test\test2.dat
Closing file d:\test\test2.dat
STATE: PERFORM => DONE handle 0x1349480; (connection #0)
Expire cleared
SFTP 0x134c348 state change from SSH_STOP to SSH_SFTP_CLOSE
Connection #0 to host foo.bar.com left intact
STATE: DONE => COMPLETED handle 0x1349480; (connection #-5000)

Etc...etc...etc...

So, for each file I see a Username / password line. Again said, FTP works fine with exactly the same settings.
Any explanation? Suggestions? Am I missing something here?

As always, your help is very much appreciated.
Thanks a lot in advance!

Cheers,
Andreas
Received on 2008-10-17