Hi,
I found that some of the code that I wrote a long while ago was doing

  curl_easy_setopt(easy, CURLOPT_TIMEOUT, timeout)

from within CURLOPT_HEADERFUNCTION and CURLOPT_WRITEFUNCTION callbacks. The idea was to implement a sliding window such that the transfer would fail if the server didn't send any data for a time. Now, I don't know whether I omitted to test this intended behaviour, or whether libcurl's treatment of timeouts has changed in the meantime, but I find that it does not now work as I had intended. I am using the multi socket framework; my timer event calls curl_multi_socket_action with CURL_SOCKET_TIMEOUT, but libcurl keeps the transfer going.

I'm not too worried about trying to make libcurl do what I intended in this case - I can apply my own timeout externally.

However, it does raise the issue of which API calls are valid in which contexts, expecially from with callback functions registered with libcurl. Perhaps the manual pages could be updated with this advice, e.g. something like:

"Note that curl_easy_setopt may only validly be called before starting a transfer; calling this function during a transfer, e.g. from a callback from libcurl, is not supported and may have unpredictable results."

What do people think?
--
Colin Hogben

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

Reply via email to