cURL / Mailing Lists / curl-library / Single Mail


Re: libcurl scp bug? - Copying file from Cisco device

From: Daniel Stenberg <>
Date: Thu, 15 Aug 2013 00:22:47 +0200 (CEST)

On Wed, 14 Aug 2013, Mike Gibson wrote:

> I turned on scp debugging on the switch (debug ip scp). Every time I request
> a file with my libcurl app, I get the following message on the switch:
> *Aug 14 17:54:19.283: SCP: [22 ->] send -p -r -d options
> not supported

I believe it is the -p causing this specifically in this case.

SCP is a tricky protocol in that it was never properly standardized or put
into a spec. The client just tells the other side which command line to run,
and it's not easy to know if the remote's scp executable support certain
options or not!

> scp user_at_192.168.2.2:bootflash:/cat4500-entservicesk9-mz.122-53.SG1.bin .

Yes, but it isn't using -p then. I suspect you might get the same error if you
try "scp -p ..." on that server.

libcurl uses libssh2 for the SCP transfer, and libssh2 uses -p automatically
if the user asks for it. In libssh2 API terms, that means if there's a struct
passed in as third argument to libssh2_scp_recv(), then -p will be used.

> I'm wondering, what is curl doing that the scp command isn't that is causing
> this? And how can I turn it off programmatically?

In libcurl, don't ask libssh2 to fill in the stat struct. In libssh2, I think
it would probably be a good idea to have it fallback to try without -p in case
it fails with it.

List admin:
Received on 2013-08-15