FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux Pacman Development

 
 
LinkBack Thread Tools
 
Old 06-01-2011, 07:24 PM
Dave Reisner
 
Default dload: abort transfer on CURLOPT_LOW_SPEED_LIMIT

If a connection drops below 10kb/s for 10s, curl will kill the transfer
and we'll report failure.

Signed-off-by: Dave Reisner <d@falconindy.com>
---
lib/libalpm/dload.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
index d024c73..3d90130 100644
--- a/lib/libalpm/dload.c
+++ b/lib/libalpm/dload.c
@@ -194,6 +194,8 @@ static int curl_download_internal(const char *url, const char *localpath,
curl_easy_setopt(handle->curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(handle->curl, CURLOPT_PROGRESSFUNCTION, curl_progress);
curl_easy_setopt(handle->curl, CURLOPT_PROGRESSDATA, (void *)&dlfile);
+ curl_easy_setopt(handle->curl, CURLOPT_LOW_SPEED_LIMIT, 10240L);
+ curl_easy_setopt(handle->curl, CURLOPT_LOW_SPEED_TIME, 10L);

useragent = getenv("HTTP_USER_AGENT");
if(useragent != NULL) {
--
1.7.5.2
 
Old 06-01-2011, 07:37 PM
Dan McGee
 
Default dload: abort transfer on CURLOPT_LOW_SPEED_LIMIT

On Wed, Jun 1, 2011 at 2:24 PM, Dave Reisner <d@falconindy.com> wrote:
> If a connection drops below 10kb/s for 10s, curl will kill the transfer
> and we'll report failure.

Yeah, the sad catch here is even 56K modems would max out at 56,600
bps == 7,000 B/sec == 6.84 KB/sec, which is below the 10K cutoff. From
the manpage which uses these opts directly:
If a download is slower than speed-limit bytes per second during
a speed-time period, the download gets aborted. If speed-time is
used, the default speed-limit will be 1 unless set with -Y.

So it seems like it is only looked at over the limit time, not the
entire length of the download as you mentioned elsewhere. The code in
lib/speedcheck.c seems to confirm this.

So I guess I'd advocate for a value below what a 28.8 K modem would
give, just so you don't frustrate someone trying to download a small
package over dial-up more than necessary. Something like 1200 would
put it even below the 14.4K mark, and yet with the limit of 10 seconds
would probably still do a good job here.

> Signed-off-by: Dave Reisner <d@falconindy.com>
> ---
> *lib/libalpm/dload.c | * *2 ++
> *1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
> index d024c73..3d90130 100644
> --- a/lib/libalpm/dload.c
> +++ b/lib/libalpm/dload.c
> @@ -194,6 +194,8 @@ static int curl_download_internal(const char *url, const char *localpath,
> * * * *curl_easy_setopt(handle->curl, CURLOPT_FOLLOWLOCATION, 1L);
> * * * *curl_easy_setopt(handle->curl, CURLOPT_PROGRESSFUNCTION, curl_progress);
> * * * *curl_easy_setopt(handle->curl, CURLOPT_PROGRESSDATA, (void *)&dlfile);
> + * * * curl_easy_setopt(handle->curl, CURLOPT_LOW_SPEED_LIMIT, 10240L);
> + * * * curl_easy_setopt(handle->curl, CURLOPT_LOW_SPEED_TIME, 10L);
>
> * * * *useragent = getenv("HTTP_USER_AGENT");
> * * * *if(useragent != NULL) {
> --
> 1.7.5.2
>
>
>
 

Thread Tools




All times are GMT. The time now is 11:44 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org