Fixed encoding/escaping of proxy username and password #1327

pull/1314/head
morpheus65535 4 years ago
parent 01b1fda8fc
commit cc335863e2

@ -3,6 +3,8 @@
import hashlib import hashlib
import os import os
from urllib.parse import quote_plus
from subliminal.cache import region from subliminal.cache import region
from simpleconfigparser import simpleconfigparser from simpleconfigparser import simpleconfigparser
@ -372,8 +374,8 @@ def configure_captcha_func():
def configure_proxy_func(): def configure_proxy_func():
if settings.proxy.type != 'None': if settings.proxy.type != 'None':
if settings.proxy.username != '' and settings.proxy.password != '': if settings.proxy.username != '' and settings.proxy.password != '':
proxy = settings.proxy.type + '://' + settings.proxy.username + ':' + settings.proxy.password + '@' + \ proxy = settings.proxy.type + '://' + quote_plus(settings.proxy.username) + ':' + \
settings.proxy.url + ':' + settings.proxy.port quote_plus(settings.proxy.password) + '@' + settings.proxy.url + ':' + settings.proxy.port
else: else:
proxy = settings.proxy.type + '://' + settings.proxy.url + ':' + settings.proxy.port proxy = settings.proxy.type + '://' + settings.proxy.url + ':' + settings.proxy.port
os.environ['HTTP_PROXY'] = str(proxy) os.environ['HTTP_PROXY'] = str(proxy)

Loading…
Cancel
Save