diff --git a/src/calibre/utils/https.py b/src/calibre/utils/https.py index b218875d6e..7365236080 100644 --- a/src/calibre/utils/https.py +++ b/src/calibre/utils/https.py @@ -154,7 +154,7 @@ else: getattr(ssl, 'match_hostname', match_hostname)(self.sock.getpeercert(), self.host) def get_https_resource_securely( - url, cacerts='calibre-ebook-root-CA.crt', timeout=60, max_redirects=5, ssl_version=None): + url, cacerts='calibre-ebook-root-CA.crt', timeout=60, max_redirects=5, ssl_version=None, headers=None): ''' Download the resource pointed to by url using https securely (verify server certificate). Ensures that redirects, if any, are also downloaded @@ -195,7 +195,7 @@ def get_https_resource_securely( path = p.path or '/' if p.query: path += '?' + p.query - c.request('GET', path) + c.request('GET', path, headers=headers or {}) response = c.getresponse() if response.status in (httplib.MOVED_PERMANENTLY, httplib.FOUND, httplib.SEE_OTHER): if max_redirects <= 0: diff --git a/src/calibre/web/feeds/recipes/collection.py b/src/calibre/web/feeds/recipes/collection.py index 16fbe75ab7..26f643a99a 100644 --- a/src/calibre/web/feeds/recipes/collection.py +++ b/src/calibre/web/feeds/recipes/collection.py @@ -208,9 +208,11 @@ def download_builtin_recipe(urn): return get_https_resource_securely('https://status.calibre-ebook.com/recipe/'+urn) def download_builtin_recipe2(urn): + from calibre.utils.config_base import prefs from calibre.utils.https import get_https_resource_securely import bz2 - return bz2.decompress(get_https_resource_securely('https://code.calibre-ebook.com/recipe-compressed/'+urn)) + return bz2.decompress(get_https_resource_securely( + 'https://code.calibre-ebook.com/recipe-compressed/'+urn, headers={'CALIBRE-INSTALL-UUID':prefs['installation_uuid']})) def get_builtin_recipe(urn): with zipfile.ZipFile(P('builtin_recipes.zip', allow_user_override=False), 'r') as zf: