cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: libcurl takes long time to connect to CoreFTP's SFTP service

From: Xu, Qiang (FXSGSC) <Qiang.Xu_at_fujixerox.com>
Date: Wed, 17 Feb 2010 16:49:11 +0800

> -----Original Message-----
> From: curl-library-bounces_at_cool.haxx.se
> [mailto:curl-library-bounces_at_cool.haxx.se] On Behalf Of
> Daniel Stenberg
> Sent: Thursday, February 11, 2010 6:41 AM
> To: libcurl development
> Subject: Re: libcurl takes long time to connect to CoreFTP's
> SFTP service
>
> I don't think it is strictly related to the slowness.
> However, it would be if you used --trace-ascii and
> --trace-time to get output that is annotated with its time to
> better give us a clue where all that time is spent!

Daniel, the following are some test results:
=====================================================
qxu_at_durian(pts/3):~/opensrc/libssh2-1.2/example/simple[103]$ date
Wed Feb 17 16:00:35 SGT 2010
qxu_at_durian(pts/3):~/opensrc/libssh2-1.2/example/simple[104]$ ./sftp 13.xxx.xxx.xxx <user> <pass>
... /* success */
all done
qxu_at_durian(pts/3):~/opensrc/libssh2-1.2/example/simple[105]$ date
Wed Feb 17 16:00:39 SGT 2010

qxu@durian(pts/3):~/opensrc/curl-7.19.6/src[111]$ ./curl -u <user>:<pass> --trace-ascii --trace-time sftp://13.xxx.xxx.xxx/ --libcurl test.c
curl: (51) SSL peer certificate or SSH remote key was not OK

qxu_at_durian(pts/3):~/opensrc/curl-7.19.6/example[133]$ date
Wed Feb 17 16:15:02 SGT 2010
qxu_at_durian(pts/3):~/opensrc/curl-7.19.6/example[134]$ ./sftp_coreftp
* About to connect() to 13.xxx.xxx.xxx port 22 (#0)
* Trying 13.xxx.xxx.xxx... * connected
* Connected to 13.xxx.xxx.xxx (13.xxx.xxx.xxx) port 22 (#0)
* SSH authentication methods available: password
* Initialized password authentication
* Authentication complete
* Failed to stop libssh2 sftp subsystem
* Closing connection #0
* Remote file not found
qxu_at_durian(pts/3):~/opensrc/curl-7.19.6/example[135]$ date
Wed Feb 17 16:25:41 SGT 2010

/* source code for sftp_coreftp.c */
#include <stdio.h>
#include <time.h>
#include <curl/curl.h>

int main(int argc, char *argv[])
{
  CURLcode ret;
  CURL *hnd = curl_easy_init();

  curl_easy_setopt(hnd, CURLOPT_URL, "sftp://13.xxx.xxx.xxx/");
  curl_easy_setopt(hnd, CURLOPT_USERPWD, "<user>:<pass>");
  curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1);

  ret = curl_easy_perform(hnd);

  curl_easy_cleanup(hnd);
  return (int)ret;
}
=====================================================
Overall, the above results are somewhat out of expectations.

1. It is very quick to connect to CoreFTP SFTP server by libssh2 command-line tool.

2. The SFTP server can't be connected, if curl command is used. It mentioned a cert error or key error, but I am using password authentication. By the way, I want to know what parameters to pass to curl_easy_setopt() for command-line parameters --trace-ascii and --trace-time, but the generated source file gave me no clue.

3. With the source code listed above and compiled into the binary sftp_coreftp, it can connect to the SFTP server, but it took more than 10 mins to finish the session. Since SFTP command can connect to the server much more quickly, I suppose it implies a defect in libcurl?

Could you do a local testing with CoreFTP server, Daniel?

Thanks,
Xu Qiang
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-02-17