__init__.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:birdnet 作者: cyysu 项目源码 文件源码
def __init__(self, sock, wsgi_app, environ):
        self.socket = sock
        self.wsgi_app = wsgi_app

        # Copy the class environ into self.
        self.environ = self.environ.copy()
        self.environ.update(environ)

        if SSL and isinstance(sock, SSL.ConnectionType):
            timeout = sock.gettimeout()
            self.rfile = SSL_fileobject(sock, "rb", self.rbufsize)
            self.rfile.ssl_timeout = timeout
            self.wfile = SSL_fileobject(sock, "wb", -1)
            self.wfile.ssl_timeout = timeout
        else:
            self.rfile = CP_fileobject(sock, "rb", self.rbufsize)
            self.wfile = CP_fileobject(sock, "wb", -1)

        # Wrap wsgi.input but not HTTPConnection.rfile itself.
        # We're also not setting maxlen yet; we'll do that separately
        # for headers and body for each iteration of self.communicate
        # (if maxlen is 0 the wrapper doesn't check length).
        self.environ["wsgi.input"] = SizeCheckWrapper(self.rfile, 0)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号