curl / Mailing Lists / curl-library / Single Mail

curl-library

Using CURLOPT_LOW_SPEED_LIMIT to detect a stalled request

From: Rory McCarthy via curl-library <curl-library_at_cool.haxx.se>
Date: Wed, 3 Oct 2018 22:57:25 +0000 (UTC)

Hi there,

I have been experimenting with CURLOPT_LOW_SPEED_LIMIT and CURLOPT_LOW_SPEED_TIME to detect when a request stalls.

I set something like the following for the request:-
   curl_easy_setopt(curl, CURLOPT_LOW_SPEED_TIME, 1L);
   curl_easy_setopt(curl, CURLOPT_LOW_SPEED_LIMIT, 1L);

I also added some debug logging via CURLOPT_DEBUGFUNCTION and CURLOPT_PROGRESSFUNCTION.

While this works, it takes longer than expected to timeout.

Reading through the libcurl source code, I think this is because it's using an average for the current transfer rate which gets compared to the CURLOPT_LOW_SPEED_LIMIT.

Is there a way to detect a stall without the delay?

Thanks,
Rory

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2018-10-04