cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: reuse easy curl handle with multi interface

From: Alex Stanciu <ealexs_at_gmail.com>
Date: Fri, 15 Jul 2011 10:49:47 +0300

Hello,

Looks like for FTP works fine, only fails for SFTP
on closer debug i end up with the error message:

"SSH public key authentication failed: Unable to open public key file"

This works fine with the easy interface
Also with the easy connection the first debug line is
"reusing connection ... "
i don't see that with the easy interface

Regards,
Alex

Friday, July 15, 2011, 10:03:50 AM, you wrote:

> Hello,

> I am working on a backup application (FTP/SFTP/FTPS), things
> worked fine so far (upload/download/commands and so on)
> but now I need to get a bit of control over curl_easy_perform

> I tried with curl_multi_perform so my reads/writes can be mapped
> to a generic function like fread. I used the example in your
> docs, I get no errors and all calls return CURLM_OK

> Now before I send the code :), can you just tell me if this usage is
> valid:

> 1. Use a CURL easy handle to common operations (FTP/SFTP)
> (this works fine)
> 2. Reuse the handle in all operations (also works ok)
> 3. Reuse the handle over multiple threads using my own
> locks (2 operations can not take place at the same time)
> (also works fine)
> 4. Temporary create a multi handle
> add the easy handle (reuse) to the multi handle
> and perform a FTP get (or upload)
> this FAILS, my CURLOPT_WRITEFUNCTION is never called (for get)

> for point 4:
> curl_easy_reset
> curl_easy_setopt(URL + rest)
> (CURLOPT_UPLOAD is also set to 0 for load)
> curl_multi_add_handle(multi_handle, handle->curl_handle)
> (returns CURLM_OK)
> curl_multi_perform
> (returns CURLM_OK)
> then i do the while (still_running) ... just like in the sample code

> as I said everything looks ok when debugging except CURLOPT_WRITEFUNCTION
> is not called and (ofc) no data is written to the buffer

> Using:
> OS: Windows Vista
> Win32 2000/XP
> 7.21.7 libcurl
> SSL enabled
> GŁnter Knauf 3.06 MB

> Many Thanks.

> Best regards,
> Alex mailto:ealexs_at_gmail.com

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-07-15