|
| 1 | +From 74d662e1e00de05779c71717626bb7ec299bdf3c Mon Sep 17 00:00:00 2001 |
| 2 | +From: Strahinja Kustudic < [email protected]> |
| 3 | +Date: Tue, 1 Aug 2023 11:17:06 +0200 |
| 4 | +Subject: [PATCH] Set secure connection as default |
| 5 | + |
| 6 | +Speedtest servers don't support HTTP connections anymore so I renamed |
| 7 | +the `--secure` parameter to `--insecure` and set it to False by default. |
| 8 | +--- |
| 9 | + speedtest.py | 10 +++++----- |
| 10 | + 1 file changed, 5 insertions(+), 5 deletions(-) |
| 11 | + |
| 12 | +diff --git a/speedtest.py b/speedtest.py |
| 13 | +index 186b52929..59540af66 100755 |
| 14 | +--- a/speedtest.py |
| 15 | ++++ b/speedtest.py |
| 16 | +@@ -946,7 +946,7 @@ class SpeedtestResults(object): |
| 17 | + """ |
| 18 | + |
| 19 | + def __init__(self, download=0, upload=0, ping=0, server=None, client=None, |
| 20 | +- opener=None, secure=False): |
| 21 | ++ opener=None, secure=True): |
| 22 | + self.download = download |
| 23 | + self.upload = upload |
| 24 | + self.ping = ping |
| 25 | +@@ -1087,7 +1087,7 @@ class Speedtest(object): |
| 26 | + """Class for performing standard speedtest.net testing operations""" |
| 27 | + |
| 28 | + def __init__(self, config=None, source_address=None, timeout=10, |
| 29 | +- secure=False, shutdown_event=None): |
| 30 | ++ secure=True, shutdown_event=None): |
| 31 | + self.config = {} |
| 32 | + |
| 33 | + self._source_address = source_address |
| 34 | +@@ -1770,8 +1770,8 @@ def parse_args(): |
| 35 | + parser.add_argument('--source', help='Source IP address to bind to') |
| 36 | + parser.add_argument('--timeout', default=10, type=PARSER_TYPE_FLOAT, |
| 37 | + help='HTTP timeout in seconds. Default 10') |
| 38 | +- parser.add_argument('--secure', action='store_true', |
| 39 | +- help='Use HTTPS instead of HTTP when communicating ' |
| 40 | ++ parser.add_argument('--insecure', action='store_true', default=False, |
| 41 | ++ help='Use HTTP instead of HTTPS when communicating ' |
| 42 | + 'with speedtest.net operated servers') |
| 43 | + parser.add_argument('--no-pre-allocate', dest='pre_allocate', |
| 44 | + action='store_const', default=True, const=False, |
| 45 | +@@ -1885,7 +1885,7 @@ def shell(): |
| 46 | + speedtest = Speedtest( |
| 47 | + source_address=args.source, |
| 48 | + timeout=args.timeout, |
| 49 | +- secure=args.secure |
| 50 | ++ secure=not args.insecure |
| 51 | + ) |
| 52 | + except (ConfigRetrievalError,) + HTTP_ERRORS: |
| 53 | + printer('Cannot retrieve speedtest configuration', error=True) |
0 commit comments