curl-and-python

Re: Aborting HTTPPOST operation

From: Abe Music <abe_at_zaffra.com>
Date: Wed, 13 Apr 2011 20:08:55 -0500

Thanks Daniel and Michael,

I will take a look at keep alive and low speed limit settings. In the event that neither of these work, you mentioned that I have the ability to kill a libcurl transfer whenever I want. I just don't understand how I'm supposed to do that if libcurl is busy in the perform() method and I only get progress updates via the PROGRESSFUNCTION option. Am I supposed to raise an exception in my progress handler and libcurl will react accordingly? I'm sorry if these are basic questions, but I'm not seeing anything in the pycurl docs on the subject of stopping a transfer.

Thanks again,

Abe

On Apr 13, 2011, at 2:15 AM, Daniel Stenberg wrote:

> On Tue, 12 Apr 2011, Abe Music wrote:
>
>> When the exception occurs it's a great thing because I can catch it and update the GUI appropriately. The problem is that sometimes an exception is not thrown and the progress function continuously reports the same number of bytes have been uploaded and it never increases. I would expect this functionality in the event no exceptions were being reported, but it's an absolute must that I can detect any anomalies during the upload and let the user know what's happening.
>
> Welcome to TCP. This is a transfer protocol that was designed to handle that nothing occurs and even that connections are teared down and put back up again without that fact causes a problem.
>
> There is only a set of things that cause the connection to actually fail hard, while many situations are not considered fatal problems.
>
> You may want to look into forcing TCP keepalive on the connection, and then with a higher frequency than the 2 hours most systems offer by default.
>
>> To workaround this I tried to keep tabs on how many times the progress function reports the same number of uploaded bytes and, after an arbitrary threshold, I let the user know and close the application (to stop the thread.) I would love to be able to stop the thread and start again later, but it appears that the perform() method has the scope in my thread and I can't make it stop.
>
> Of course you can use all sorts of metrics in your own code to decide when you think the transfer has stalled. As it is just stalled. When you put everything back and plug in again, the transfer is capable of continuing.
>
> And you're free to tell libcurl to stop the transfer when you think it should!
>
> --
>
> / daniel.haxx.se
> _______________________________________________
> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
>

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
Received on 2011-04-14