def _get_ready_socket(self):
     sock = socket.safety_socket(self.timeout, socket.AF_INET,
                                 socket.SOCK_STREAM)
     self.msglog('Going to connect to server')
     sock.connect((self._server, self._port))
     http_sock = sock
     if self._secure:
         realsock = sock
         if hasattr(sock, '_sock'):
             realsock = sock._sock
         ssl = socket.ssl(realsock, properties.PRIVATE_KEY_FILE,
                          properties.CERTIFICATE_PEM_FILE)
         http_sock = FakeSocket(sock, ssl)
     return http_sock
Example #2
0
 def connect(self, timeout=None):
     if timeout is None:
         timeout = self._timeout
     self._timeout = timeout
     if self._timeout is None:
         sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     else:
         sock = socket.safety_socket(self._timeout, socket.AF_INET,
                                     socket.SOCK_STREAM)
     sock.connect((self.host, self.port))
     realsock = sock
     if hasattr(sock, '_sock'):
         realsock = sock._sock
     ssl = socket.ssl(realsock, self.key_file, self.cert_file)
     self.sock = FakeSocket(sock, ssl)
Example #3
0
 def _get_ready_socket(self):
     sock = socket.safety_socket(self.timeout, socket.AF_INET, socket.SOCK_STREAM)
     self.msglog('Going to connect to server')
     sock.connect((self._server, self._port))
     http_sock = sock
     if self._secure:
         realsock = sock
         if hasattr(sock, '_sock'):
             realsock = sock._sock
         ssl = socket.ssl(
             realsock, 
             properties.PRIVATE_KEY_FILE, 
             properties.CERTIFICATE_PEM_FILE
         )
         http_sock = FakeSocket(sock, ssl)
     return http_sock
Example #4
0
 def connect(self,timeout=None):
     if timeout is None:
         timeout = self._timeout
     self._timeout = timeout
     if self._timeout is None:
         sock = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
     else:
         sock = socket.safety_socket(self._timeout,
                                     socket.AF_INET,
                                     socket.SOCK_STREAM)
     sock.connect((self.host,self.port))
     realsock = sock
     if hasattr(sock,'_sock'):
         realsock = sock._sock
     ssl = socket.ssl(realsock,self.key_file,self.cert_file)
     self.sock = FakeSocket(sock,ssl)