- Timestamp:
- 10/31/13 22:44:46 (11 years ago)
- Location:
- etherws/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
etherws/trunk/etherws.py
r259 r265 5 5 # 6 6 # depends on: 7 # - python-2.7. 28 # - python-pytun- 0.29 # - websocket-client-0. 7.010 # - tornado-2. 37 # - python-2.7.5 8 # - python-pytun-2.1 9 # - websocket-client-0.12.0 10 # - tornado-2.4 11 11 # 12 12 # =========================================================================== … … 682 682 super(ClientHandler, self).__init__(*args, **kwargs) 683 683 684 self._ssl = kwargs.get('ssl', False)684 self._sslopt = kwargs.get('sslopt', {}) 685 685 self._options = {} 686 686 … … 693 693 694 694 def open(self): 695 sslwrap = websocket._SSLSocketWrapper696 697 695 if not self.closed: 698 696 raise websocket.WebSocketException('Already opened') 699 697 700 if self._ssl:701 websocket._SSLSocketWrapper = self._ssl702 703 698 # XXX: may be blocked 704 try: 705 self.register_device(websocket.WebSocket()) 706 self.device.connect(self.target, **self._options) 707 self.dprintf('connected: %s\n', lambda: self.target) 708 return self.join_switch() 709 finally: 710 websocket._SSLSocketWrapper = sslwrap 711 712 def fileno(self): 713 if self.closed: 714 raise websocket.WebSocketException('Closed socket') 715 return self.device.io_sock.fileno() 699 self.register_device(websocket.WebSocket(sslopt=self._sslopt)) 700 self.device.connect(self.target, **self._options) 701 self.dprintf('connected: %s\n', lambda: self.target) 702 return self.join_switch() 716 703 717 704 def write_message(self, message, binary=False): … … 854 841 855 842 def _optparse_client(self, opt): 856 args = {'cert_reqs': ssl.CERT_REQUIRED, 'ca_certs': opt.get('cacerts')}857 843 if opt.get('insecure'): 858 args = {} 859 ssl_ = lambda sock: ssl.wrap_socket(sock, **args) 844 sslopt = {} 845 else: 846 sslopt = {'cert_reqs': ssl.CERT_REQUIRED, 847 'ca_certs': opt.get('cacerts')} 860 848 cred = {'user': opt.get('user'), 'passwd': opt.get('passwd')} 861 return {'ssl ': ssl_, 'cred': cred}849 return {'sslopt': sslopt, 'cred': cred} 862 850 863 851 def _jsonrpc_response(self, id_=None, result=None, error=None): -
etherws/trunk/setup.py
r261 r265 48 48 platforms=['Linux'], 49 49 install_requires=[ 50 'python-pytun>= 0.2',51 'websocket-client>=0. 7.0',52 'tornado>=2. 3',50 'python-pytun>=2.1', 51 'websocket-client>=0.12.0', 52 'tornado>=2.4', 53 53 ], 54 54 classifiers=[
Note: See TracChangeset
for help on using the changeset viewer.