RE: curl library 7.36.0: curl_easy_perform() function call failed when used for getting a file from Window's machine to my linux box

2016-10-20 Thread Zhao, Joe
Really appreciate your help.
We have used curl library for a few years and there is no issue at all until 
this one. Function call curl_easy_perform() returns error code 79 when trying 
to get a file from a Window machine. However, there is no issue for getting a 
file from a linux machine using the same piece of code. I hesitate to update 
the curl library since it works fine for other application such as sftp.


-Original Message-
From: curl-library [mailto:curl-library-boun...@cool.haxx.se] On Behalf Of 
dev_user
Sent: Thursday, October 20, 2016 3:04 AM
To: curl-library@cool.haxx.se
Subject: Re: curl library 7.36.0: curl_easy_perform() function call failed when 
used for getting a file from Window's machine to my linux box

On 10/19/2016 08:20 PM, Zhao, Joe wrote:
> There is no scp.c in curl package 7.36.0

I have scp and sftp being used with libssh2 and libcurl very neatly for years 
also.  Very stable.

However I am generally doing updates of libcurl often and simply doing a 
recompile of libcurl as well as openssl and libssh2 isn't that big a deal. The 
code written years ago ( mostly in C ) works and keeps working and after some 
testing I promote the code up to my testing tier for a whole slew of users to 
test. After another week I promote upwards to the production layer and have 
been doing this, for years. LibCurl is without a doubt one of them most stable 
slick bits of code out there and yes I have the tee-shirt too. :-)

So ... I shall glance at your code but if it works then it will keep working.

Also, for the love of all that is holy on the internet and elsewhere stop top 
posting.

> I haven't got the chance to review the source code of 7.51.0 version.

I'm using 7.50.3 at the moment. That is up to date :

 https://curl.haxx.se/changes.html

> Do we have to rewrite our application code for using the new curl
 > library?

Not very likely but I have not seen ALL of it. I sure don't need to update 
mine. I sure don't go digging into several hundred thousand lines of code ( 
about 220,000+ at last count ) in my work world every time libCurl or openssl 
or libssh2 updates.  That is for sure.

Are there changes happening and coders at work ?  Yes.  However code that 
worked five years ago .. keeps on working. Pretty well tested.

> Here is our application code for getting a file using scp via curl library.
>

>char remotePath[4096]; /* Have big enough buffer to construct 
> remote
>  server name, userid, passwd, 
> filename & path */

You may be better off to calloc/malloc what you need to be super safe and also 
( at least in my stuff ) do a character test on the strings to be sure they are 
utf8 valid with no special chars to make life hell.

>char err[4096];
>int  attempt = 1;
>int  retries;
>int  retryInterval;

cool .. a recyle on attempts may be needed with a delay stairstep function that 
drives the wait time upwards to some cutoff.

>XftpCurlFile xftpLocalfile = { pXftpParams->localFileName, NULL};

yeah .. about this, do you know the file exists and you can get to it ?


do you stat and check this file ?

 struct stat fid_check_exists;
 stat_foo = stat ( pXftpParams->localFileName, &fid_check_exists );

Just an idea.

 if ( stat_foo != 0 ) {
 /* deal with it */
 exit ( EXIT_FAILURE );  /* or whatever works */
 }

>   retries   = bUseRetries ? 1 : 0;
>retryInterval = 15;

sec ?  millisec ? just curious.

>
>curl_global_init(CURL_GLOBAL_DEFAULT);
>do
>{
>   if (attempt > 1)
>  delay(retryInterval * 1000);

oh .. okay . .so secs I guess.


>   curl = curl_easy_init();
>   if (curl)
>   {

If you want ssh then I am suggesting you use key files too .. unless you don't 
need them. Have this somewhere :

   char* ssh_pub_key_file = "/somepath/keys/foo/bar_rsa.id.pub";
   char* ssh_priv_key_file = "/somepath/keys/foo/bar_rsa.id";
   char* ssh_pass = "";

then in this big loopy "if" somewhere :

 curl_easy_setopt ( curl, CURLOPT_SSH_PUBLIC_KEYFILE,
  ssh_pub_key_file );

 curl_easy_setopt ( curl, CURLOPT_SSH_PRIVATE_KEYFILE,
  ssh_priv_key_file );

 curl_easy_setopt ( curl, CURLOPT_KEYPASSWD,
  ssh_pass );

The password here is the passphrase on the key. You may not need this.

 curl_easy_setopt ( curl, CURLOPT_VERBOSE, 1L );
/* you have this somewhere I see */

 curl_easy_setopt ( curl, CURLOPT_DEBUGFUNCTION, audit_log );

Not sure if you want that either but it is nice to track events and log them.


>  // Build TFTP/FTP/SFTP string required for CURL
>  

RE: curl library 7.36.0: curl_easy_perform() function call failed when used for getting a file from Window's machine to my linux box

2016-10-20 Thread Daniel Stenberg

On Thu, 20 Oct 2016, Zhao, Joe wrote:


There is no scp.c in curl package 7.36.0.


Allow be to be so bold to quote my own messsage you replied to:

  "This last message is the error string from libssh2"

libssh2 is not curl. libssh2 is *used* by curl. I pointed out to the function 
within libssh2 that returns the error message you saw.


--

 / daniel.haxx.se
---
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:  https://curl.haxx.se/mail/etiquette.html

Re: curl library 7.36.0: curl_easy_perform() function call failed when used for getting a file from Window's machine to my linux box

2016-10-20 Thread dev_user

On 10/19/2016 08:20 PM, Zhao, Joe wrote:

There is no scp.c in curl package 7.36.0


I have scp and sftp being used with libssh2 and libcurl very neatly for
years also.  Very stable.

However I am generally doing updates of libcurl often and simply doing
a recompile of libcurl as well as openssl and libssh2 isn't that big a
deal. The code written years ago ( mostly in C ) works and keeps working
and after some testing I promote the code up to my testing tier for a
whole slew of users to test. After another week I promote upwards to the
production layer and have been doing this, for years. LibCurl is without
a doubt one of them most stable slick bits of code out there and yes I
have the tee-shirt too. :-)

So ... I shall glance at your code but if it works then it will keep
working.

Also, for the love of all that is holy on the internet and elsewhere
stop top posting.


I haven't got the chance to review the source code of 7.51.0 version.


I'm using 7.50.3 at the moment. That is up to date :

https://curl.haxx.se/changes.html


Do we have to rewrite our application code for using the new curl

> library?

Not very likely but I have not seen ALL of it. I sure don't need to
update mine. I sure don't go digging into several hundred thousand
lines of code ( about 220,000+ at last count ) in my work world every
time libCurl or openssl or libssh2 updates.  That is for sure.

Are there changes happening and coders at work ?  Yes.  However code
that worked five years ago .. keeps on working. Pretty well tested.


Here is our application code for getting a file using scp via curl library.




   char remotePath[4096]; /* Have big enough buffer to construct remote
 server name, userid, passwd, filename & 
path */


You may be better off to calloc/malloc what you need to be super safe
and also ( at least in my stuff ) do a character test on the strings to
be sure they are utf8 valid with no special chars to make life hell.


   char err[4096];
   int  attempt = 1;
   int  retries;
   int  retryInterval;


cool .. a recyle on attempts may be needed with a delay stairstep
function that drives the wait time upwards to some cutoff.


   XftpCurlFile xftpLocalfile = { pXftpParams->localFileName, NULL};


yeah .. about this, do you know the file exists and you can get to it ?


do you stat and check this file ?

struct stat fid_check_exists;
stat_foo = stat ( pXftpParams->localFileName, &fid_check_exists );

Just an idea.

if ( stat_foo != 0 ) {
/* deal with it */
exit ( EXIT_FAILURE );  /* or whatever works */
}


  retries   = bUseRetries ? 1 : 0;
   retryInterval = 15;


sec ?  millisec ? just curious.



   curl_global_init(CURL_GLOBAL_DEFAULT);
   do
   {
  if (attempt > 1)
 delay(retryInterval * 1000);


oh .. okay . .so secs I guess.



  curl = curl_easy_init();
  if (curl)
  {


If you want ssh then I am suggesting you use key files too .. unless
you don't need them. Have this somewhere :

  char* ssh_pub_key_file = "/somepath/keys/foo/bar_rsa.id.pub";
  char* ssh_priv_key_file = "/somepath/keys/foo/bar_rsa.id";
  char* ssh_pass = "";

then in this big loopy "if" somewhere :

curl_easy_setopt ( curl, CURLOPT_SSH_PUBLIC_KEYFILE,
 ssh_pub_key_file );

curl_easy_setopt ( curl, CURLOPT_SSH_PRIVATE_KEYFILE,
 ssh_priv_key_file );

curl_easy_setopt ( curl, CURLOPT_KEYPASSWD,
 ssh_pass );

The password here is the passphrase on the key. You may not need this.

curl_easy_setopt ( curl, CURLOPT_VERBOSE, 1L );
   /* you have this somewhere I see */

curl_easy_setopt ( curl, CURLOPT_DEBUGFUNCTION, audit_log );

Not sure if you want that either but it is nice to track events and log
them.



 // Build TFTP/FTP/SFTP string required for CURL
 if (xftpURLGet(curl, remotePath, sizeof(remotePath),
pXftpParams->hostname, pXftpParams->username,
pXftpParams->password,
pXftpParams->remoteFileName,
pXftpParams->hostmode) == False)
 {
curl_easy_cleanup(curl);
curl_global_cleanup();
return XftpStatus_CurlInitFailed;
 }

 if (curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT,
  pXftpParams->hostmode == XftpMode_Sftp ?
  XFTP_DEFAULT_SFTP_TIMEOUT :
  XFTP_DEFAULT_FTP_TIMEOUT) != CURLE_OK)
 {
curl_easy_cleanup(curl);
curl_global_cleanup();
return XftpStatus_CurlInitFailed;
 }

 if (curl_easy_setopt(curl, CURLOPT_LOW_SPEED_LIMIT,  
XFTP_DEFAULT_LOW_SPEED_LIMIT) != CURLE_OK)
 {
curl_easy_cleanup(curl);
curl_global_cleanup();

RE: curl library 7.36.0: curl_easy_perform() function call failed when used for getting a file from Window's machine to my linux box

2016-10-19 Thread Zhao, Joe
There is no scp.c in curl package 7.36.0. I haven't got the chance to review 
the source code of 7.51.0 version. Do we have to rewrite our application code 
for using the new curl library? Here is our application code for getting a file 
using scp via curl library. 

GsStatus
xftp_get_file_e(XftpParams *pXftpParams, Boolean bUseRetries,
char *stderrStr, int stderrSize)
{
   CURL*curl;
   CURLcode res = CURLE_FAILED_INIT;
   char remotePath[4096]; /* Have big enough buffer to construct remote
 server name, userid, passwd, filename & 
path */
   char err[4096];
   int  attempt = 1;
   int  retries;
   int  retryInterval;
   XftpCurlFile xftpLocalfile = { pXftpParams->localFileName, NULL};
  retries   = bUseRetries ? 1 : 0;   
   retryInterval = 15;

   curl_global_init(CURL_GLOBAL_DEFAULT);
   do
   {
  if (attempt > 1)
 delay(retryInterval * 1000);
  curl = curl_easy_init();
  if (curl)
  {
 // Build TFTP/FTP/SFTP string required for CURL
 if (xftpURLGet(curl, remotePath, sizeof(remotePath),
pXftpParams->hostname, pXftpParams->username,
pXftpParams->password,
pXftpParams->remoteFileName,
pXftpParams->hostmode) == False)
 {
curl_easy_cleanup(curl);
curl_global_cleanup();
return XftpStatus_CurlInitFailed;
 }

 if (curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT,
  pXftpParams->hostmode == XftpMode_Sftp ?
  XFTP_DEFAULT_SFTP_TIMEOUT :
  XFTP_DEFAULT_FTP_TIMEOUT) != CURLE_OK)
 {
curl_easy_cleanup(curl);
curl_global_cleanup();
return XftpStatus_CurlInitFailed;
 }

 if (curl_easy_setopt(curl, CURLOPT_LOW_SPEED_LIMIT,  
XFTP_DEFAULT_LOW_SPEED_LIMIT) != CURLE_OK)
 {
curl_easy_cleanup(curl);
curl_global_cleanup();
return XftpStatus_CurlInitFailed;
 }

 if (curl_easy_setopt(curl, CURLOPT_LOW_SPEED_TIME , 
XFTP_DEFAULT_LOW_SPEED_TIME) != CURLE_OK)
 {
curl_easy_cleanup(curl);
curl_global_cleanup();
return XftpStatus_CurlInitFailed;
 }

 if (curl_easy_setopt(curl, CURLOPT_URL, remotePath) != CURLE_OK)
 {
curl_easy_cleanup(curl);
curl_global_cleanup();
return XftpStatus_CurlInitFailed;
 }

 /* Define our callback to get called when there's data to be written */
 if (curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, my_fwrite) != 
CURLE_OK)
 {
curl_easy_cleanup(curl);
curl_global_cleanup();
return XftpStatus_CurlInitFailed;
 }

 /* Set a pointer to our struct to pass to the callback */
 if (curl_easy_setopt(curl, CURLOPT_WRITEDATA, &xftpLocalfile) != 
CURLE_OK)
 {
curl_easy_cleanup(curl);
curl_global_cleanup();
return XftpStatus_CurlInitFailed;
 }

 /* Set transfer mode to Binary (0 == BIN) */
 if (curl_easy_setopt(curl, CURLOPT_TRANSFERTEXT, 0) != CURLE_OK)
 {
curl_easy_cleanup(curl);
curl_global_cleanup();
return XftpStatus_CurlInitFailed;
 }
 /* Switch on full protocol/debug output */
 curl_easy_setopt(curl, CURLOPT_VERBOSE, XFTP_VERBOSE_LEVEL);
 /* Switch on full protocol/debug output */
 curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, err);
 res = curl_easy_perform(curl);
 /* always cleanup */
 curl_easy_cleanup(curl);

 if (xftpLocalfile.stream)
 {
fclose(xftpLocalfile.stream); /* close the local file */
 }
  }
   } while ((res != CURLE_OK) && (attempt++ <= retries));
curl_global_cleanup();
return xftpCurlResultToGsStatus(res);
}  /* xftp_get_file_e */


-Original Message-
From: curl-library [mailto:curl-library-boun...@cool.haxx.se] On Behalf Of 
Daniel Stenberg
Sent: Wednesday, October 19, 2016 7:07 PM
To: libcurl development 
Subject: RE: curl library 7.36.0: curl_easy_perform() function call failed when 
used for getting a file from Window's machine to my linux box

On Wed, 19 Oct 2016, Zhao, Joe wrote:

> * Authentication complete
> * SSH CONNECT phase done
> * Failed reading SCP response

This last message is the error string from libssh2 (the src/scp.c:scp_recv 
function to be exact). So I maintain that you need to try to use libssh2 
directly and see what you can figure out. And make sure you try this with the 
latest libssh2 first before you spend a lot of time on it.

-- 

  / daniel.haxx.se
--

RE: curl library 7.36.0: curl_easy_perform() function call failed when used for getting a file from Window's machine to my linux box

2016-10-19 Thread Zhao, Joe
We started the project a few years ago and didn't update the curl library. 
Since changing the curl library in our project involves a lot of regression 
work, I would like to know if my current issue is solved in the latest version 
before I plan to upgrade the library.
Really appreciate your help. 

-Original Message-
From: curl-library [mailto:curl-library-boun...@cool.haxx.se] On Behalf Of 
dev_user
Sent: Wednesday, October 19, 2016 6:27 PM
To: curl-library@cool.haxx.se
Subject: Re: curl library 7.36.0: curl_easy_perform() function call failed when 
used for getting a file from Window's machine to my linux box

On 10/19/2016 11:35 AM, Zhao, Joe wrote:
> Has this issue being reported or has it been addressed in the new curl 
> releases?

Merely a small question : Is there a good reason why you are using
   libcurl from years ago ?

If you need to run applications with libcurl it really is best to use a very up 
to date version. It builds really well and you may only need
libssh2 and openssl to make your life complete.

If you need help with that I am sure you could be up and running with the 
latest in fairly short order.

Dennis


---
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:  https://curl.haxx.se/mail/etiquette.html

---
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:  https://curl.haxx.se/mail/etiquette.html

RE: curl library 7.36.0: curl_easy_perform() function call failed when used for getting a file from Window's machine to my linux box

2016-10-19 Thread Daniel Stenberg

On Wed, 19 Oct 2016, Zhao, Joe wrote:


* Authentication complete
* SSH CONNECT phase done
* Failed reading SCP response


This last message is the error string from libssh2 (the src/scp.c:scp_recv 
function to be exact). So I maintain that you need to try to use libssh2 
directly and see what you can figure out. And make sure you try this with the 
latest libssh2 first before you spend a lot of time on it.


--

 / daniel.haxx.se
---
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:  https://curl.haxx.se/mail/etiquette.html

Re: curl library 7.36.0: curl_easy_perform() function call failed when used for getting a file from Window's machine to my linux box

2016-10-19 Thread dev_user

On 10/19/2016 11:35 AM, Zhao, Joe wrote:

Has this issue being reported or has it been addressed in the new curl releases?


Merely a small question : Is there a good reason why you are using
  libcurl from years ago ?

If you need to run applications with libcurl it really is best to use a 
very up to date version. It builds really well and you may only need 
libssh2 and openssl to make your life complete.


If you need help with that I am sure you could be up and running with 
the latest in fairly short order.


Dennis


---
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:  https://curl.haxx.se/mail/etiquette.html

RE: curl library 7.36.0: curl_easy_perform() function call failed when used for getting a file from Window's machine to my linux box

2016-10-19 Thread Zhao, Joe
Hi,

I have collected the following logs when trying to get a file from a Window's 
machine (with SCP server running) using scp to my local linux box using curl 
library call curl_easy_perform().
 using scp via curl library curl_easy_perform () call: failed with 
error code 79.  
WORKING:: SCP file transfer in progress! 
* Hostname was NOT found in DNS cache
*   Trying 10.128.125.85...
* Connected to 10.128.125.85 (10.128.125.85) port 22 (#1)
Joe: xftp_get_file_e()-579 to call xftpURLGet()
xftpURLGet-244: URL=scp://scp:cws@10.128.125.85/~/dummy.log
Joe: xftp_get_file_e()-672 to call curl_easy_perform(). localF=sftp.log 
remoteF=dummy.log hostmode=4 
* SSH MD5 fingerprint: e33b4955e1153c1da3707578c37ca3d9
* SSH authentication methods available: password
* Initialized password authentication
* Authentication complete
* SSH CONNECT phase done
* Failed reading SCP response
* Connection #1 to host 10.128.125.85 left intact
Joe: xftp_get_file_e()-677 called curl_easy_perform(). res=79 localF=sftp.log 
remoteF=dummy.log hostmode=4

The function call curl_easy_perform() returns with error code 79.

I have also collected following logs when trying to get a file from a Window's 
machine (with SFTP/SCP server running) using sftp to my local linux box using 
curl library call curl_easy_perform().
 using scp via curl library curl_easy_perform () call: passed with error 
code 0.  ===
Joe: xftp_get_file_e()-579 to call xftpURLGet()
WORKING:: SFTP file transfer in progress 
xftpURLGet-244: URL=sftp://scp:cws@10.128.125.85/~/dummy.log
Joe: xftp_get_file_e()-672 to call curl_easy_perform(). localF=sftp.log 
remoteF=dummy.log hostmode=3 
* Hostname was NOT found in DNS cache
*   Trying 10.128.125.85...
* Connected to 10.128.125.85 (10.128.125.85) port 22 (#0)
* SSH MD5 fingerprint: e33b4955e1153c1da3707578c37ca3d9
* SSH authentication methods available: password
* Initialized password authentication
* Authentication complete
* Connection #0 to host 10.128.125.85 left intact
Joe: xftp_get_file_e()-677 called curl_easy_perform(). res=0 localF=sftp.log 
remoteF=dummy.log hostmode=3


Does anyone have any thoughts from the logs?

Thanks a lot.

Joe


-Original Message-
From: Zhao, Joe 
Sent: Wednesday, October 19, 2016 11:36 AM
To: libcurl development 
Subject: RE: curl library 7.36.0: curl_easy_perform() function call failed when 
used for getting a file from Window's machine to my linux box

Has this issue being reported or has it been addressed in the new curl 
releases? I can update the curl library if required. 

-Original Message-
From: curl-library [mailto:curl-library-boun...@cool.haxx.se] On Behalf Of 
Daniel Stenberg
Sent: Tuesday, October 18, 2016 4:47 PM
To: libcurl development 
Subject: RE: curl library 7.36.0: curl_easy_perform() function call failed when 
used for getting a file from Window's machine to my linux box

On Tue, 18 Oct 2016, Zhao, Joe wrote:

Please stop the top-posting.

> Yes, I mean scp server. I have installed scp server on my window's 
> machine for the test. On my linux machine, I am able to get a file 
> from the Window's machine (scp server running) if I use the linux scp command 
> from shell.
> However, if I use curl library in my application code for getting a 
> file from Window's machine, I got the error 79. As I mentioned, if the 
> scp server is on another linux machine, I am able to get a file using curl 
> library.

That sounds like a problem with libssh2 (and again, the verbose mode may 
explain some of it). The next step is probably to build a test application 
directly with libssh2 and see what that says as I fear it will fail the same 
way... and then debugging libssh2 is the next step.

A basic SCP example for libssh2 is here:

   https://libssh2.org/examples/scp.html

But of course, for libssh2 debugging and help on that route, you're better off 
on the libssh2-devel mailing list.

-- 

  / daniel.haxx.se
---
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:  https://curl.haxx.se/mail/etiquette.html

---
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:  https://curl.haxx.se/mail/etiquette.html

RE: curl library 7.36.0: curl_easy_perform() function call failed when used for getting a file from Window's machine to my linux box

2016-10-19 Thread Zhao, Joe
Has this issue being reported or has it been addressed in the new curl 
releases? I can update the curl library if required. 

-Original Message-
From: curl-library [mailto:curl-library-boun...@cool.haxx.se] On Behalf Of 
Daniel Stenberg
Sent: Tuesday, October 18, 2016 4:47 PM
To: libcurl development 
Subject: RE: curl library 7.36.0: curl_easy_perform() function call failed when 
used for getting a file from Window's machine to my linux box

On Tue, 18 Oct 2016, Zhao, Joe wrote:

Please stop the top-posting.

> Yes, I mean scp server. I have installed scp server on my window's 
> machine for the test. On my linux machine, I am able to get a file 
> from the Window's machine (scp server running) if I use the linux scp command 
> from shell.
> However, if I use curl library in my application code for getting a 
> file from Window's machine, I got the error 79. As I mentioned, if the 
> scp server is on another linux machine, I am able to get a file using curl 
> library.

That sounds like a problem with libssh2 (and again, the verbose mode may 
explain some of it). The next step is probably to build a test application 
directly with libssh2 and see what that says as I fear it will fail the same 
way... and then debugging libssh2 is the next step.

A basic SCP example for libssh2 is here:

   https://libssh2.org/examples/scp.html

But of course, for libssh2 debugging and help on that route, you're better off 
on the libssh2-devel mailing list.

-- 

  / daniel.haxx.se
---
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:  https://curl.haxx.se/mail/etiquette.html

---
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:  https://curl.haxx.se/mail/etiquette.html

RE: curl library 7.36.0: curl_easy_perform() function call failed when used for getting a file from Window's machine to my linux box

2016-10-18 Thread Daniel Stenberg

On Tue, 18 Oct 2016, Zhao, Joe wrote:

Please stop the top-posting.

Yes, I mean scp server. I have installed scp server on my window's machine 
for the test. On my linux machine, I am able to get a file from the Window's 
machine (scp server running) if I use the linux scp command from shell. 
However, if I use curl library in my application code for getting a file 
from Window's machine, I got the error 79. As I mentioned, if the scp server 
is on another linux machine, I am able to get a file using curl library.


That sounds like a problem with libssh2 (and again, the verbose mode may 
explain some of it). The next step is probably to build a test application 
directly with libssh2 and see what that says as I fear it will fail the same 
way... and then debugging libssh2 is the next step.


A basic SCP example for libssh2 is here:

  https://libssh2.org/examples/scp.html

But of course, for libssh2 debugging and help on that route, you're better off 
on the libssh2-devel mailing list.


--

 / daniel.haxx.se
---
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:  https://curl.haxx.se/mail/etiquette.html

RE: curl library 7.36.0: curl_easy_perform() function call failed when used for getting a file from Window's machine to my linux box

2016-10-18 Thread Zhao, Joe
Yes, I mean scp server. I have installed scp server on my window's machine for 
the test. 
On my linux machine, I am able to get a file from the Window's machine (scp 
server running) if I use the linux scp command from shell. However, if I use 
curl library in my application code for getting a file from Window's machine, I 
got the error 79. As I mentioned, if the scp server is on another linux 
machine, I am able to get a file using curl library. 


-Original Message-
From: curl-library [mailto:curl-library-boun...@cool.haxx.se] On Behalf Of 
Daniel Stenberg
Sent: Tuesday, October 18, 2016 11:37 AM
To: libcurl development 
Subject: RE: curl library 7.36.0: curl_easy_perform() function call failed when 
used for getting a file from Window's machine to my linux box

On Tue, 18 Oct 2016, Zhao, Joe wrote:

> I am attempting SCP transfer. The SCP transfer works if the 
> destination is linux box but not working if the destination is 
> Window's machine. In fact, SFTP transferring works in both linux and Window's 
> machine.

Destination? You mean server, right? SCP is generally much less portable and is 
often only a unix-thing so are you sure your windows server supports SCP in the 
first place? Can you use openssh's scp command against it?

-- 

  / daniel.haxx.se
---
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:  https://curl.haxx.se/mail/etiquette.html

---
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:  https://curl.haxx.se/mail/etiquette.html

RE: curl library 7.36.0: curl_easy_perform() function call failed when used for getting a file from Window's machine to my linux box

2016-10-18 Thread Daniel Stenberg

On Tue, 18 Oct 2016, Zhao, Joe wrote:

I am attempting SCP transfer. The SCP transfer works if the destination is 
linux box but not working if the destination is Window's machine. In fact, 
SFTP transferring works in both linux and Window's machine.


Destination? You mean server, right? SCP is generally much less portable and 
is often only a unix-thing so are you sure your windows server supports SCP in 
the first place? Can you use openssh's scp command against it?


--

 / daniel.haxx.se
---
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:  https://curl.haxx.se/mail/etiquette.html

RE: curl library 7.36.0: curl_easy_perform() function call failed when used for getting a file from Window's machine to my linux box

2016-10-18 Thread Zhao, Joe
Thanks for your feedback.
I am attempting SCP transfer. The SCP transfer works if the destination is 
linux box but not working if the destination is Window's machine. In fact, SFTP 
transferring works in both linux and Window's machine.  

-Original Message-
From: curl-library [mailto:curl-library-boun...@cool.haxx.se] On Behalf Of 
Daniel Stenberg
Sent: Tuesday, October 18, 2016 11:15 AM
To: libcurl development 
Subject: Re: curl library 7.36.0: curl_easy_perform() function call failed when 
used for getting a file from Window's machine to my linux box

On Tue, 18 Oct 2016, Zhao, Joe wrote:

> - The function call has successfully passed if getting a file from an 
> external linux box to my linux box
>
> - The function call has failed with the error code (79) if getting a 
> file from window PC to my linux box

79 is CURLE_SSH, so I assume you're attempting SFTP transfers? I assume those 
two machines run different servers? It sounds just like libssh2 (which handles 
the SSH level bits for curl) has problems with one of them.

The general advice is also to enable CURLOPT_VERBOSE and see if that helps you 
get any additional clues as to what goes wrong.

> Is this issue reported before? If so, is it being fixed in the newer 
> version of the curl library?

It's hard to say. I'd say its worth trying the latest version anyway as if it 
isn't fixed there, that's a much better point to start debugging in order to 
fix... But as I said, this may also just be a libssh2 issue.

-- 

  / daniel.haxx.se
---
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:  https://curl.haxx.se/mail/etiquette.html

---
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:  https://curl.haxx.se/mail/etiquette.html

Re: curl library 7.36.0: curl_easy_perform() function call failed when used for getting a file from Window's machine to my linux box

2016-10-18 Thread Daniel Stenberg

On Tue, 18 Oct 2016, Zhao, Joe wrote:

- The function call has successfully passed if getting a file from an 
external linux box to my linux box


- The function call has failed with the error code (79) if getting a file 
from window PC to my linux box


79 is CURLE_SSH, so I assume you're attempting SFTP transfers? I assume those 
two machines run different servers? It sounds just like libssh2 (which handles 
the SSH level bits for curl) has problems with one of them.


The general advice is also to enable CURLOPT_VERBOSE and see if that helps you 
get any additional clues as to what goes wrong.


Is this issue reported before? If so, is it being fixed in the newer version 
of the curl library?


It's hard to say. I'd say its worth trying the latest version anyway as if it 
isn't fixed there, that's a much better point to start debugging in order to 
fix... But as I said, this may also just be a libssh2 issue.


--

 / daniel.haxx.se
---
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:  https://curl.haxx.se/mail/etiquette.html