-
Notifications
You must be signed in to change notification settings - Fork 20
replace ssl.wrap_socket with context.wrap_socket #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -77,12 +77,12 @@ def connect(self, host=None, port=None, address_family=None): | |||||||
| local_addr, local_port, self.sock.getpeername()[0], port) | ||||||||
| self.sock.settimeout(self.socket_timeout) # regular timeout | ||||||||
| if self.ssl_enable: | ||||||||
| self.sock = ssl.wrap_socket(self.sock, self.keyfile, self.certfile, | ||||||||
| ssl_version=self.ssl_version, | ||||||||
| ciphers=self.ssl_ciphers, | ||||||||
| server_side=False, | ||||||||
| cert_reqs=self.cert_required, | ||||||||
| ca_certs=self.cacerts) | ||||||||
| context = ssl.create_default_context() | ||||||||
| context.load_verify_locations(self.cacerts) | ||||||||
| context.load_cert_chain(self.certfile, self.keyfile) | ||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
| context.check_hostname = self.validate_hostname | ||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Setting |
||||||||
| context.verify_mode = self.cert_required | ||||||||
| self.sock = context.wrap_socket(self.sock, server_hostname=host, server_side=False) | ||||||||
| self.log.debug('%s negotiated with local=%s:%s remote=%s:%s', self.sock.version(), | ||||||||
| local_addr, local_port, self.sock.getpeername()[0], port) | ||||||||
| if self.validate_hostname: | ||||||||
|
|
||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
context.load_verify_locationswill raise aTypeErrorifself.cacertsisNone.Also, we should still set ciphers if requested: