parameters: (self, sock)
return_statement: return s, self.get_environ(s)
docstring: Wrap and return the given socket, plus WSGI environ entries.
docstring_summary: Wrap and return the given socket, plus WSGI environ entries.
docstring_tokens: Wrap and return the given socket plus WSGI environ entries .
function: def wrap(self, sock):
          """Wrap and return the given socket, plus WSGI environ entries."""
          try:
              s = ssl.wrap_socket(sock, do_handshake_on_connect=True,
                      server_side=True, certfile=self.certificate,
                      keyfile=self.private_key, ssl_version=ssl.PROTOCOL_SSLv23)
          except ssl.SSLError:
              e = sys.exc_info()[1]
              if e.errno == ssl.SSL_ERROR_EOF:
                  # This is almost certainly due to the cherrypy engine
                  # 'pinging' the socket to assert it's connectable;
                  # the 'ping' isn't SSL.
                  return None, {}
              elif e.errno == ssl.SSL_ERROR_SSL:
                  if e.args[1].endswith('http request'):
                      # The client is speaking HTTP to an HTTPS server.
                      raise wsgiserver.NoSSLError
                  elif e.args[1].endswith('unknown protocol'):
                      # The client is speaking some non-HTTP protocol.
                      # Drop the conn.
                      return None, {}
              raise
          return s, self.get_environ(s)
function_tokens: def wrap ( self , sock ) : try : s = ssl . wrap_socket ( sock , do_handshake_on_connect = True , server_side = True , certfile = self . certificate , keyfile = self . private_key , ssl_version = ssl . PROTOCOL_SSLv23 ) except ssl . SSLError : e = sys . exc_info ( ) [ 1 ] if e . errno == ssl . SSL_ERROR_EOF : # This is almost certainly due to the cherrypy engine # 'pinging' the socket to assert it's connectable; # the 'ping' isn't SSL. return None , { } elif e . errno == ssl . SSL_ERROR_SSL : if e . args [ 1 ] . endswith ( 'http request' ) : # The client is speaking HTTP to an HTTPS server. raise wsgiserver . NoSSLError elif e . args [ 1 ] . endswith ( 'unknown protocol' ) : # The client is speaking some non-HTTP protocol. # Drop the conn. return None , { } raise return s , self . get_environ ( s )