Commit 051773e4 authored by juga's avatar juga
Browse files

Merge branch 'bug28788'

Solved conflicts in:
	docs/source/examples/sbws.example.ini
	sbws/globals.py
applying both theirs and ours.
parents 149e236e 216b29bd
......@@ -37,4 +37,7 @@ url = https://example.com/does/not/exist.bin
; # Not adding %(asctime)s to to stdout since it'll go to syslog when using
; # systemd, and it'll have already the date.
; to_stdout_format = ${format}
; to_syslog_format = ${format}
\ No newline at end of file
; to_syslog_format = ${format}
# To disable certificate validation, uncomment the following
# verify = False
\ No newline at end of file
......@@ -69,6 +69,9 @@ destinations.STR
url = STR
The URL to the destination. It must include a file path.
It can use both http or https.
verify = BOOL
Whether or not to verify the destination certificate.
(Default: True)
tor
......
......@@ -86,6 +86,7 @@ HTTP_GET_HEADERS = {
'Range': '{}',
'Accept-Encoding': 'identity',
}
DESTINATION_VERIFY_CERTIFICATE = True
def fail_hard(*a, **kw):
......
......@@ -6,6 +6,8 @@ from threading import RLock
import requests
from urllib.parse import urlparse
from stem.control import EventType
from sbws.globals import DESTINATION_VERIFY_CERTIFICATE
import sbws.util.stem as stem_utils
import sbws.util.requests as requests_utils
......@@ -14,9 +16,9 @@ log = logging.getLogger(__name__)
def _parse_verify_option(conf_section):
if 'verify' not in conf_section:
return True
return DESTINATION_VERIFY_CERTIFICATE
try:
return conf_section.getboolean('verify')
verify = conf_section.getboolean('verify')
except ValueError:
log.warning(
'Currently sbws only supports verify=true/false, not a CA bundle '
......@@ -26,6 +28,11 @@ def _parse_verify_option(conf_section):
'of testing. So we will allow this, but expect Requests to throw '
'SSLError exceptions later. Have fun!', conf_section['verify'])
return conf_section['verify']
if not verify:
# disable urllib3 warning: InsecureRequestWarning
import urllib3
urllib3.disable_warnings()
return verify
def connect_to_destination_over_circuit(dest, circ_id, session, cont, max_dl):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment