cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Aborting from progress callback during connection doesn't work

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 10 Aug 2010 00:33:30 +0200 (CEST)

On Mon, 9 Aug 2010, Adam Light wrote:

> I'm using libcurl 7.21.0 in my application. I have a progress callback
> function which makes a call to my application to see if it should tell
> libcurl to abort. The progress function works fine during a transfer, but
> if the progress function is called during the connect phase and returns a
> non-zero value, libcurl does not abort the connection attempt. This is
> using the easy interface.
>
> I have stepped through the libcurl code in the debugger and it looks
> to me like the problem is in the singleipconnect() function.

I fully agree. It is clearly a bug there.

> The waitconnect() function returns CURLE_ABORTED_BY_CALLBACK but then
> singleipconnect() doesn't do anything with that return code.
> singleipconnect() does return CURL_SOCKET_BAD when this happens, but the
> calling function, Curl_connecthost(), tries again instead of aborting.
>
> I assume this behavior is not intentional, and therefore a bug. I'm not
> sure whether it's best fixed from singleipconnect() or Curl_connecthost().

I think we should modify singleipconnect() to be able to return back some kind
of error code instead of just a socket or CURL_SOCKET_BAD, so that
CURLE_ABORTED_BY_CALLBACK can be promoted back to the parent function
properly.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2010-08-10