本文整理汇总了Python中wsgiref.simple_server.WSGIServer.get_request方法的典型用法代码示例。如果您正苦于以下问题:Python WSGIServer.get_request方法的具体用法?Python WSGIServer.get_request怎么用?Python WSGIServer.get_request使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wsgiref.simple_server.WSGIServer
的用法示例。
在下文中一共展示了WSGIServer.get_request方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_request
# 需要导入模块: from wsgiref.simple_server import WSGIServer [as 别名]
# 或者: from wsgiref.simple_server.WSGIServer import get_request [as 别名]
def get_request(self):
socket, client_address = WSGIServer.get_request(self)
socket = ssl.wrap_socket(socket,
server_side=True,
certfile=SERVER_CERT_FILE,
keyfile=SERVER_KEY_FILE)
return socket, client_address
示例2: get_unix_request
# 需要导入模块: from wsgiref.simple_server import WSGIServer [as 别名]
# 或者: from wsgiref.simple_server.WSGIServer import get_request [as 别名]
def get_unix_request(self):
sock, _ = WSGIServer.get_request(self)
cred = sock.getsockopt(socket.SOL_SOCKET,
socket.SO_PEERCRED,
self.csize)
cred = struct.unpack('3i', cred)
ret = [sock, ['pid: %i, uid: %i, gid: %i' % cred, 0]]
return ret
示例3: get_request
# 需要导入模块: from wsgiref.simple_server import WSGIServer [as 别名]
# 或者: from wsgiref.simple_server.WSGIServer import get_request [as 别名]
def get_request(self):
sock, addr = WSGIServer.get_request(self)
if len(self.clients) >= self.limit:
# Too many clients, disconnect idle ones.
self.kill_idle_clients()
if len(self.clients) >= self.limit:
# We _still_ have too many connected non-idle clients. We
# can't accept this request.
return sock.close()
client = NonBlockingClient(self, sock, addr)
self.clients[client] = time.time()
log.debug2('new client [%d]: %s:%d', client.fileno(), *addr)
return client, addr