diff options
author | Brad Warren <bmw@users.noreply.github.com> | 2017-09-19 01:56:26 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-19 01:56:26 +0300 |
commit | 6aabb31eb5656c258c4c66ddbdaa9eba8da221f0 (patch) | |
tree | db0945f3385039a1901dbc68a8629d9078f82f1c | |
parent | 3acde31ed363bc32bbfbf069d4270d021b500374 (diff) | |
parent | e7884898ec9c09006a8c6bcb3f7a612eeb018326 (diff) |
Merge pull request #5118 from erikrose/certbot-auto-timeout
Certbot auto timeout
-rwxr-xr-x | letsencrypt-auto-source/letsencrypt-auto | 7 | ||||
-rw-r--r-- | letsencrypt-auto-source/pieces/fetch.py | 7 |
2 files changed, 10 insertions, 4 deletions
diff --git a/letsencrypt-auto-source/letsencrypt-auto b/letsencrypt-auto-source/letsencrypt-auto index 4b55e480f..dc2bd6ac0 100755 --- a/letsencrypt-auto-source/letsencrypt-auto +++ b/letsencrypt-auto-source/letsencrypt-auto @@ -1361,7 +1361,8 @@ from os.path import dirname, join import re from subprocess import check_call, CalledProcessError from sys import argv, exit -from urllib2 import build_opener, HTTPHandler, HTTPSHandler, HTTPError +from urllib2 import build_opener, HTTPHandler, HTTPSHandler +from urllib2 import HTTPError, URLError PUBLIC_KEY = environ.get('LE_AUTO_PUBLIC_KEY', """-----BEGIN PUBLIC KEY----- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA6MR8W/galdxnpGqBsYbq @@ -1397,7 +1398,9 @@ class HttpsGetter(object): """ try: - return self._opener.open(url).read() + # socket module docs say default timeout is None: that is, no + # timeout + return self._opener.open(url, timeout=30).read() except (HTTPError, IOError) as exc: raise ExpectedError("Couldn't download %s." % url, exc) diff --git a/letsencrypt-auto-source/pieces/fetch.py b/letsencrypt-auto-source/pieces/fetch.py index e7ebb9e0a..8f34351c9 100644 --- a/letsencrypt-auto-source/pieces/fetch.py +++ b/letsencrypt-auto-source/pieces/fetch.py @@ -20,7 +20,8 @@ from os.path import dirname, join import re from subprocess import check_call, CalledProcessError from sys import argv, exit -from urllib2 import build_opener, HTTPHandler, HTTPSHandler, HTTPError +from urllib2 import build_opener, HTTPHandler, HTTPSHandler +from urllib2 import HTTPError, URLError PUBLIC_KEY = environ.get('LE_AUTO_PUBLIC_KEY', """-----BEGIN PUBLIC KEY----- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA6MR8W/galdxnpGqBsYbq @@ -56,7 +57,9 @@ class HttpsGetter(object): """ try: - return self._opener.open(url).read() + # socket module docs say default timeout is None: that is, no + # timeout + return self._opener.open(url, timeout=30).read() except (HTTPError, IOError) as exc: raise ExpectedError("Couldn't download %s." % url, exc) |