uploading with curl

Jonas Drewsen jdrewsen at nospam.com
Mon Apr 30 12:37:48 PDT 2012


On Thursday, 19 April 2012 at 07:26:44 UTC, Gleb wrote:
> Jonas, thanks for your answer.
>
> On Tuesday, 17 April 2012 at 20:03:57 UTC, Jonas Drewsen wrote:
>> This is one of the many reasons I believe we should do our own
>> network library. Curl only support timeouts for connecting and
>> for the entire transfer. What you really want is better control
>> with sane defaults: DNS lookup timeout, connect timeout,
>> read/write activity timeout and timout for the entire 
>> operation.
>>
>> Default "entire operation" timeout should be infinity and the
>> rest just some qualified guesses.
>>
>> Anyway... I think the current default timeouts are how they
>> should be.
> There are DNS timeout and connect timeout in current 
> std.net.curl. The entire operation timeout is infinity means 
> there is no such timeout - this is what curl library offers.
> There is also some kind of read/write activity "timeout" in the 
> library because the connection will be dropped if ftp-server 
> shutdowns suddenly during uploading. That's why I don't see why 
> we have to have the data connection timeout which does not 
> allow the big files to be downloaded or uploaded.

Sorry for the delayed answer.

If the ftp server shuts down the tcp connection is broken and you 
will get notified immediately. This has nothing to do with 
timeouts (except maybe tcp timeouts in some cases which are 
normally handled by the OS).

Most other libraries have a default timeout afaik and that makes 
sense to me. As stated in my last reply the real solution would 
to have an activity timeout which would make it reasonable to set 
an infinite timeout for the entire transfer.

>> Regarding the 10 week limit you're mentioning please see the 
>> docs
>> for the Duration type:
>> http://dlang.org/phobos/core_time.html#Duration
> Thank's for the link! I've read it twice but unfortunately the 
> reason of 10 weeks limit is still not clear for me. Moreover I 
> can't understand why would dataTimeout influences 
> connectTimeout in such way if the value I use is more then 10 
> weeks.

I've not read the code for Duration but my guess is that it wraps 
around and becomes a negative duration if you exceed the limit. 
This would of course make it timeout immediately.


>> What you're describing sounds like a bug and I'll have a look 
>> at
>> it.
> Thank you very much! Your contribution to D's curl library 
> support is outstanding.

Just trying to make D a better place to be as so many others do :)

/Jonas


More information about the Digitalmars-d mailing list