cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: How to get file size over SFTP? And use private key with passphrase?

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Sat, 19 Sep 2009 23:19:03 +0200 (CEST)

On Fri, 18 Sep 2009, Gary V. Vaughan wrote:

> I'm writing a multi-protocol file download application using pycurl 7.19
> built with libcurl from the curl-7.19.6 release. I want to use my own
> progress bar, so I need to know the file size in advance of launching the
> download proper...

The progress callback informs about the file size, if known. You don't need to
do any particular file size check of your own for that to happen.

> The above works only if I use a key with no-passphrase. Is it possible to
> use a key that takes a passphrase?

I believe so, yes.

> pycurl.URL: 'sftp://example.com/~/a_26MB_binary_file',
> pycurl.USERPWD: 'gary:key pass-phrase'

USERPWD is for the remote auth, not for the key auth. CURLOPT_KEYPASSWD is
what you want I believe.

> is it possible to get just the filesize over SFTP using pycurl?

No, unfortunately at least not in that conveniant CURLOPT_NOBODY way most
other protocols support.

It'd be a great addition though.

-- 
  / daniel.haxx.se
Received on 2009-09-19