mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
When downloading recipes/get books plugins use HTTPS
This commit is contained in:
parent
f969151e9f
commit
4e1cd543f5
@ -13,7 +13,7 @@ from collections import OrderedDict
|
||||
from threading import Thread
|
||||
from urllib import urlencode
|
||||
|
||||
from calibre import prints, browser
|
||||
from calibre import prints
|
||||
from calibre.constants import numeric_version, DEBUG
|
||||
from calibre.gui2.store import StorePlugin
|
||||
from calibre.utils.config import JSONConfig
|
||||
@ -23,14 +23,14 @@ class VersionMismatch(ValueError):
|
||||
ValueError.__init__(self, 'calibre too old')
|
||||
self.ver = ver
|
||||
|
||||
def download_updates(ver_map={}, server='http://status.calibre-ebook.com'):
|
||||
def download_updates(ver_map={}, server='https://status.calibre-ebook.com'):
|
||||
from calibre.utils.https import get_https_resource_securely
|
||||
data = {k:type(u'')(v) for k, v in ver_map.iteritems()}
|
||||
data['ver'] = '1'
|
||||
url = '%s/stores?%s'%(server, urlencode(data))
|
||||
br = browser()
|
||||
# We use a timeout here to ensure the non-daemonic update thread does not
|
||||
# cause calibre to hang indefinitely during shutdown
|
||||
raw = br.open(url, timeout=4.0).read()
|
||||
raw = get_https_resource_securely(url, timeout=90.0)
|
||||
|
||||
while raw:
|
||||
name, raw = raw.partition(b'\0')[0::2]
|
||||
|
@ -13,7 +13,7 @@ from datetime import timedelta
|
||||
from lxml import etree
|
||||
from lxml.builder import ElementMaker
|
||||
|
||||
from calibre import browser, force_unicode
|
||||
from calibre import force_unicode
|
||||
from calibre.utils.date import parse_date, now as nowf, utcnow, tzlocal, \
|
||||
isoformat, fromordinal
|
||||
from calibre.utils.recycle_bin import delete_file
|
||||
@ -186,8 +186,8 @@ def get_builtin_recipe_titles():
|
||||
return [r.get('title') for r in get_builtin_recipe_collection()]
|
||||
|
||||
def download_builtin_recipe(urn):
|
||||
br = browser()
|
||||
return br.open_novisit('http://status.calibre-ebook.com/recipe/'+urn).read()
|
||||
from calibre.utils.https import get_https_resource_securely
|
||||
return get_https_resource_securely('https://status.calibre-ebook.com/recipe/'+urn)
|
||||
|
||||
def get_builtin_recipe(urn):
|
||||
with zipfile.ZipFile(P('builtin_recipes.zip', allow_user_override=False), 'r') as zf:
|
||||
|
Loading…
x
Reference in New Issue
Block a user