Skip to content

Commit

Permalink
Merge pull request #138 from Alix82/SMT12
Browse files Browse the repository at this point in the history
Add two curl options LowSpeedLimit and LowSpeedTime
  • Loading branch information
felixsch authored Aug 18, 2020
2 parents 9e5440f + 8dc989e commit fb553c0
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
NAME = smt
VERSION = 3.0.43
VERSION = 3.0.44
DESTDIR = /
PERL ?= perl
PERLMODDIR = $(shell $(PERL) -MConfig -e 'print $$Config{installvendorlib};')
Expand Down
5 changes: 5 additions & 0 deletions config/smt.conf
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ signingKeyID=
# Configure the Connect Timeout for curl
#ConnectTimeout = 5

#
# Abort download if speed is below LowSpeedLimit bytes/sec for LowSpeedTime seconds
#LowSpeedLimit = 512
#LowSpeedTime = 120

# Mirroring credentials for this SMT server.
# These are currently only used to get list of all available repositories
# from https://your.smt.url/repo/repoindex.xml
Expand Down
7 changes: 7 additions & 0 deletions package/smt.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Fri Jul 30 15:27:01 UTC 2020 - Ali Abdallah <[email protected]>

- Version 3.0.44
- Add two options LowSpeedLimit and LowSpeedTime to configure
CURLOPT_LOW_SPEED_LIMIT and CURLOPT_LOW_SPEED_TIME (bsc#1174348)

-------------------------------------------------------------------
Fri Jul 9 13:12:08 UTC 2020 - Felix Schnizlein <[email protected]>

Expand Down
2 changes: 1 addition & 1 deletion package/smt.spec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


Name: smt
Version: 3.0.43
Version: 3.0.44
Release: 0
Summary: Subscription Management Tool
License: GPL-2.0+
Expand Down
20 changes: 18 additions & 2 deletions www/perl-lib/SMT/Curl.pm
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,24 @@ sub new
$self->setopt(CURLOPT_SSLVERSION, 1 ); # 1 should be CURL_SSLVERSION_TLSv1

# Abort download if speed is below 512 bytes/sec for 120 sec, to prevent downloads from getting stuck
$self->setopt(CURLOPT_LOW_SPEED_LIMIT, 512 );
$self->setopt(CURLOPT_LOW_SPEED_TIME, 120 );
# Those values can be configured, by setting 'LowSpeedLimit' and 'LowSpeedTime'
if (exists $opt{lowspeedlimit})
{
$self->setopt(CURLOPT_LOW_SPEED_LIMIT, $opt{lowspeedlimit});
}
else
{
$self->setopt(CURLOPT_LOW_SPEED_LIMIT, 512 );
}

if (exists $opt{lowspeedtime})
{
$self->setopt(CURLOPT_LOW_SPEED_TIME, $opt{lowspeedtime});
}
else
{
$self->setopt(CURLOPT_LOW_SPEED_TIME, 120 );
}

if(exists $opt{useragent})
{
Expand Down
2 changes: 2 additions & 0 deletions www/perl-lib/SMT/Utils.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1038,6 +1038,8 @@ sub createUserAgent
if (! exists $opts{connecttimeout})
{
$opts{connecttimeout} = int($cfg->val('LOCAL', 'ConnectTimeout', 5));
$opts{lowspeedlimit} = int($cfg->val('LOCAL', 'LowSpeedLimit', 512));
$opts{lowspeedtime} = int($cfg->val('LOCAL', 'LowSpeedTime', 120));
}

require SMT::Curl;
Expand Down

0 comments on commit fb553c0

Please sign in to comment.