curl / Mailing Lists / curl-library / Single Mail

curl-library

Curl_handler.connecting returning CURLE_AGAIN

From: Richard W.M. Jones <rjones_at_redhat.com>
Date: Tue, 17 Jul 2018 12:40:16 +0100

I've written my Curl_handler.connecting callback so it returns
CURLE_AGAIN if the socket would block. However this causes the whole
connection to fail (see debug trace at end).

If I change the callback so it loops until *done == TRUE then it
works, but I think this is just blocking behaviour.

I can see the PROTOCONNECT case in lib/multi.c doesn't deal with
CURLE_AGAIN at all.

Should I return CURLE_OK (and *done == FALSE) in the blocking case?
What is the point of CURLE_AGAIN?

Rich.

----------------------------------------------------------------------

* STATE: INIT => CONNECT handle 0x1c620a8; line 1447 (connection #-5000)
* Rebuilt URL to: nbd://localhost/
* Added connection 0. The cache now contains 1 members
* STATE: CONNECT => WAITRESOLVE handle 0x1c620a8; line 1483 (connection #0)
  % Total % Received % Xferd Average Speed Time Time Time Current
                                 Dload Upload Total Spent Left Speed
  0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Trying ::1...
* TCP_NODELAY set
* STATE: WAITRESOLVE => WAITCONNECT handle 0x1c620a8; line 1564 (connection #0)
* Connected to localhost (::1) port 10809 (#0)
* STATE: WAITCONNECT => SENDPROTOCONNECT handle 0x1c620a8; line 1616 (connection #0)
* NBD 0x1c56bb0 state change from STOP to EXPECTING_MAGIC
* Marked for [keep alive]: NBD default
* STATE: SENDPROTOCONNECT => PROTOCONNECT handle 0x1c620a8; line 1630 (connection #0)
* NBD 0x1c56bb0 connecting state is EXPECTING_MAGIC
* multi_done
  0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
* Closing connection 0
* The cache now contains 0 members
* Expire cleared
curl: (81) Socket not ready for send/recv

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2018-07-17