On Tue, Apr 02, 2019 at 03:39:14PM +0530, Prashant Shubham via curl-library wrote: > If there is an ongoing curl request and the application receives > SIGTERM, is there a way curl can acknowledge and abort the request in > middle.
The most reliable way to do this is probably to write a SIGTERM handler that sets a global flag, then check the flag from the CURLOPT_XFERINFOFUNCTION callback function and return non-zero when it's set. This will cause the transfer to be aborted and return CURLE_ABORTED_BY_CALLBACK. CURLOPT_XFERINFOFUNCTION is called fairly frequently even when nothing is happening so there won't be much of a delay before the signal is acknowledged. You can also check the flag in your read/write callback function to reduce the delay even further in the case of an ongoing transfer. >>> Dan ------------------------------------------------------------------- Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library Etiquette: https://curl.haxx.se/mail/etiquette.html