diff options
| author | Simeon Simeonov | 2015-04-17 15:17:59 +0200 |
|---|---|---|
| committer | Simeon Simeonov | 2015-04-17 15:17:59 +0200 |
| commit | c7e57ae16ea9024ec55f401a18158c09bc45a1a3 (patch) | |
| tree | 5501acebecb777219c45f781de825d7a92f08de0 /beinc_weechat.py | |
| parent | b2120ed79c11505a326f18d8b465449dd0f6d57c (diff) | |
Last polishing before v2.0
Diffstat (limited to 'beinc_weechat.py')
| -rw-r--r-- | beinc_weechat.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/beinc_weechat.py b/beinc_weechat.py index c52396d..5082c1d 100644 --- a/beinc_weechat.py +++ b/beinc_weechat.py | |||
| @@ -154,7 +154,7 @@ class WeechatTarget(object): | |||
| 154 | self.__debug = bool(target_dict.get('debug', False)) | 154 | self.__debug = bool(target_dict.get('debug', False)) |
| 155 | self.__enabled = bool(target_dict.get('enabled', True)) | 155 | self.__enabled = bool(target_dict.get('enabled', True)) |
| 156 | self.__socket_timeout = int(target_dict.get('socket_timeout', 3)) | 156 | self.__socket_timeout = int(target_dict.get('socket_timeout', 3)) |
| 157 | self.__ciphers = target_dict.get('ciphers', '') | 157 | self.__ssl_ciphers = target_dict.get('ssl_ciphers', '') |
| 158 | self.__disable_hostname_check = bool( | 158 | self.__disable_hostname_check = bool( |
| 159 | target_dict.get('disable-hostname-check', False)) | 159 | target_dict.get('disable-hostname-check', False)) |
| 160 | self.__ssl_version = target_dict.get('ssl_version', 'auto') | 160 | self.__ssl_version = target_dict.get('ssl_version', 'auto') |
| @@ -333,6 +333,10 @@ class WeechatTarget(object): | |||
| 333 | """ | 333 | """ |
| 334 | if self.__connection: | 334 | if self.__connection: |
| 335 | return True | 335 | return True |
| 336 | if self.__debug: | ||
| 337 | beinc_prnt( | ||
| 338 | 'BEINC DEBUG: (Re)Establishing connection to: {0}'.format( | ||
| 339 | self.__url)) | ||
| 336 | try: | 340 | try: |
| 337 | ssl_version = BEINC_SSL_METHODS.get(self.__ssl_version, | 341 | ssl_version = BEINC_SSL_METHODS.get(self.__ssl_version, |
| 338 | ssl.PROTOCOL_SSLv23) | 342 | ssl.PROTOCOL_SSLv23) |
| @@ -346,8 +350,8 @@ class WeechatTarget(object): | |||
| 346 | self.__cert_file)) | 350 | self.__cert_file)) |
| 347 | context.check_hostname = bool( | 351 | context.check_hostname = bool( |
| 348 | not self.__disable_hostname_check) | 352 | not self.__disable_hostname_check) |
| 349 | if self.__ciphers: | 353 | if self.__ssl_ciphers: |
| 350 | context.set_ciphers(self.__ciphers) | 354 | context.set_ciphers(self.__ssl_ciphers) |
| 351 | transport = xmlrpclib.SafeTransport(context=context) | 355 | transport = xmlrpclib.SafeTransport(context=context) |
| 352 | else: | 356 | else: |
| 353 | # Python < 2.7.9 | 357 | # Python < 2.7.9 |
| @@ -357,8 +361,8 @@ class WeechatTarget(object): | |||
| 357 | ssl_options['ca_certs'] = os.path.expanduser( | 361 | ssl_options['ca_certs'] = os.path.expanduser( |
| 358 | self.__cert_file) | 362 | self.__cert_file) |
| 359 | ssl_options['cert_reqs'] = ssl.CERT_REQUIRED | 363 | ssl_options['cert_reqs'] = ssl.CERT_REQUIRED |
| 360 | if self.__ciphers: | 364 | if self.__ssl_ciphers: |
| 361 | ssl_options['ciphers'] = self.__ciphers | 365 | ssl_options['ciphers'] = self.__ssl_ciphers |
| 362 | transport = BEINCCustomSafeTransport( | 366 | transport = BEINCCustomSafeTransport( |
| 363 | custom_ssl_options=ssl_options) | 367 | custom_ssl_options=ssl_options) |
| 364 | self.__connection = xmlrpclib.ServerProxy(self.__url, | 368 | self.__connection = xmlrpclib.ServerProxy(self.__url, |
