Show More
@@ -284,6 +284,6 b' class http2handler(urlreq.httphandler, u' | |||||
284 |
|
284 | |||
285 | con = HTTPConnection(host, port, use_ssl=True, |
|
285 | con = HTTPConnection(host, port, use_ssl=True, | |
286 | ssl_wrap_socket=sslutil.wrapsocket, |
|
286 | ssl_wrap_socket=sslutil.wrapsocket, | |
287 |
ssl_validator=sslutil.validat |
|
287 | ssl_validator=sslutil.validatesocket, | |
288 | **kwargs) |
|
288 | **kwargs) | |
289 | return con |
|
289 | return con |
@@ -139,7 +139,7 b' def _smtp(ui):' | |||||
139 | s.ehlo() |
|
139 | s.ehlo() | |
140 | if (starttls or smtps) and verifycert: |
|
140 | if (starttls or smtps) and verifycert: | |
141 | ui.note(_('(verifying remote certificate)\n')) |
|
141 | ui.note(_('(verifying remote certificate)\n')) | |
142 |
sslutil.validat |
|
142 | sslutil.validatesocket(s.sock, verifycert == 'strict') | |
143 | username = ui.config('smtp', 'username') |
|
143 | username = ui.config('smtp', 'username') | |
144 | password = ui.config('smtp', 'password') |
|
144 | password = ui.config('smtp', 'password') | |
145 | if username and not password: |
|
145 | if username and not password: |
@@ -291,11 +291,11 b' def sslkwargs(ui, host):' | |||||
291 |
|
291 | |||
292 | return kws |
|
292 | return kws | |
293 |
|
293 | |||
294 | class validator(object): |
|
294 | def validatesocket(sock, strict=False): | |
295 | def __init__(self, ui=None, host=None): |
|
295 | """Validate a socket meets security requiremnets. | |
296 | pass |
|
|||
297 |
|
|
296 | ||
298 | def __call__(self, sock, strict=False): |
|
297 | The passed socket must have been created with ``wrapsocket()``. | |
|
298 | """ | |||
299 |
|
|
299 | host = sock._hgstate['hostname'] | |
300 |
|
|
300 | ui = sock._hgstate['ui'] | |
301 |
|
301 |
@@ -356,7 +356,7 b' if has_https:' | |||||
356 | self.sock = sslutil.wrapsocket( |
|
356 | self.sock = sslutil.wrapsocket( | |
357 | self.sock, self.key_file, self.cert_file, serverhostname=host, |
|
357 | self.sock, self.key_file, self.cert_file, serverhostname=host, | |
358 | **sslutil.sslkwargs(self.ui, host)) |
|
358 | **sslutil.sslkwargs(self.ui, host)) | |
359 |
sslutil.validat |
|
359 | sslutil.validatesocket(self.sock) | |
360 |
|
360 | |||
361 | class httpshandler(keepalive.KeepAliveHandler, urlreq.httpshandler): |
|
361 | class httpshandler(keepalive.KeepAliveHandler, urlreq.httpshandler): | |
362 | def __init__(self, ui): |
|
362 | def __init__(self, ui): |
General Comments 0
You need to be logged in to leave comments.
Login now