def __init__(self, request_handler, max_request=10485760, keep_alive=True, cookie_secret=None, xheaders=False, **kwargs): Server.__init__(self, **kwargs) # Storage self.request_handler = request_handler self.max_request = max_request self.keep_alive = keep_alive self.xheaders = xheaders self._cookie_secret = cookie_secret
def __init__(self, request_handler, max_request=10485760, keep_alive=True, cookie_secret=None, xheaders=False, sendfile=False, sendfile_prefix=None, file_root=None, **kwargs): Server.__init__(self, **kwargs) # Storage self.request_handler = request_handler self.max_request = max_request self.keep_alive = keep_alive self.xheaders = xheaders self.sendfile = sendfile self.sendfile_prefix = sendfile_prefix self.file_root = os.path.abspath(file_root) if file_root else None self._cookie_secret = cookie_secret
def listen(self, address=None, backlog=1024, slave=True): """ Begins listening for connections to the HTTP server. The given ``address`` is resolved, the server is bound to the address, and it then begins listening for connections. If an address isn't specified, the server will listen on either port 80 or port 443 by default. Port 443 is selected if SSL has been enabled prior to the call to listen, otherwise port 80 will be used. .. seealso:: See :func:`pants.server.Server.listen` for more information on listening servers. """ if address is None or isinstance(address, (list,tuple)) and \ len(address) > 1 and address[1] is None: if self.ssl_enabled: port = 443 else: port = 80 if address is None: address = port else: address = tuple(address[0] + (port, ) + address[2:]) return Server.listen(self, address=address, backlog=backlog, slave=slave)
def listen(self, address=None, backlog=1024, slave=True): """ Begins listening for connections to the HTTP server. The given ``address`` is resolved, the server is bound to the address, and it then begins listening for connections. If an address isn't specified, the server will listen on either port 80 or port 443 by default. Port 443 is selected if SSL has been enabled prior to the call to listen, otherwise port 80 will be used. .. seealso:: See :func:`pants.server.Server.listen` for more information on listening servers. """ if address is None or isinstance(address, (list,tuple)) and \ len(address) > 1 and address[1] is None: if self.ssl_enabled: port = 443 else: port = 80 if address is None: address = port else: address = tuple(address[0] + (port,) + address[2:]) return Server.listen(self, address=address, backlog=backlog, slave=slave)
def listen(self, address=None, backlog=1024, slave=True): """ Begins listening for connections to the HTTP server. The given ``address`` is resolved, the server is bound to the address, and it then begins listening for connections. If an address isn't specified, the server will listen on either port 80 or port 443 by default. .. seealso:: See :func:`pants.server.Server.listen` for more information on listening servers. ========= ============================================================ Argument Description ========= ============================================================ address *Optional.* The local address to listen for connections on. If this isn't specified, it will be set to either port 80 or port 443, depending on the SSL state, and listen on INADDR_ANY. backlog *Optional.* The maximum size of the connection queue. slave *Optional.* If True, this will cause a Server listening on IPv6 INADDR_ANY to create a slave Server that listens on the IPv4 INADDR_ANY. ========= ============================================================ """ if address is None or isinstance(address, (list,tuple)) and \ len(address) > 1 and address[1] is None: if self.ssl_enabled: port = 443 else: port = 80 if address is None: address = port else: address = tuple(address[0] + (port,) + address[2:]) return Server.listen(self, address=address, backlog=backlog, slave=slave)