当前位置: 首页>>代码示例>>Python>>正文


Python iostream.UnsatisfiableReadError方法代码示例

本文整理汇总了Python中tornado.iostream.UnsatisfiableReadError方法的典型用法代码示例。如果您正苦于以下问题:Python iostream.UnsatisfiableReadError方法的具体用法?Python iostream.UnsatisfiableReadError怎么用?Python iostream.UnsatisfiableReadError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tornado.iostream的用法示例。


在下文中一共展示了iostream.UnsatisfiableReadError方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _server_request_loop

# 需要导入模块: from tornado import iostream [as 别名]
# 或者: from tornado.iostream import UnsatisfiableReadError [as 别名]
def _server_request_loop(self, delegate):
        try:
            while True:
                conn = HTTP1Connection(self.stream, False,
                                       self.params, self.context)
                request_delegate = delegate.start_request(self, conn)
                try:
                    ret = yield conn.read_response(request_delegate)
                except (iostream.StreamClosedError,
                        iostream.UnsatisfiableReadError):
                    return
                except _QuietException:
                    # This exception was already logged.
                    conn.close()
                    return
                except Exception:
                    gen_log.error("Uncaught exception", exc_info=True)
                    conn.close()
                    return
                if not ret:
                    return
                yield gen.moment
        finally:
            delegate.on_close(self) 
开发者ID:tao12345666333,项目名称:tornado-zh,代码行数:26,代码来源:http1connection.py

示例2: _read_first_line

# 需要导入模块: from tornado import iostream [as 别名]
# 或者: from tornado.iostream import UnsatisfiableReadError [as 别名]
def _read_first_line(self, stream, address):
        try:
            header_future = stream.read_until_regex(b'\r?\n\r?\n',
                                                    max_bytes=self.conn_params.max_header_size)
            if self.conn_params.header_timeout is None:
                header_data = yield header_future
            else:
                try:
                    header_data = yield gen.with_timeout(
                        stream.io_loop.time() + self.conn_params.header_timeout,
                        header_future,
                        quiet_exceptions=StreamClosedError)
                except gen.TimeoutError:
                    stream.close()
                    return
            # TODO: make this less hacky
            stream._read_buffer[:0] = header_data
            stream._read_buffer_size += len(header_data)
            if header_data == b'PRI * HTTP/2.0\r\n\r\n':
                self._start_http2(stream, address)
            else:
                super(CleartextHTTP2Server, self)._start_http1(stream, address)
        except (StreamClosedError, UnsatisfiableReadError):
            pass 
开发者ID:bdarnell,项目名称:tornado_http2,代码行数:26,代码来源:server.py

示例3: test_large_headers

# 需要导入模块: from tornado import iostream [as 别名]
# 或者: from tornado.iostream import UnsatisfiableReadError [as 别名]
def test_large_headers(self):
        with ExpectLog(gen_log, "Unsatisfiable read"):
            with self.assertRaises(UnsatisfiableReadError):
                self.fetch("/large", raise_error=True) 
开发者ID:opendevops-cn,项目名称:opendevops,代码行数:6,代码来源:simple_httpclient_test.py

示例4: _server_request_loop

# 需要导入模块: from tornado import iostream [as 别名]
# 或者: from tornado.iostream import UnsatisfiableReadError [as 别名]
def _server_request_loop(
        self, delegate: httputil.HTTPServerConnectionDelegate
    ) -> None:
        try:
            while True:
                conn = HTTP1Connection(self.stream, False, self.params, self.context)
                request_delegate = delegate.start_request(self, conn)
                try:
                    ret = await conn.read_response(request_delegate)
                except (
                    iostream.StreamClosedError,
                    iostream.UnsatisfiableReadError,
                    asyncio.CancelledError,
                ):
                    return
                except _QuietException:
                    # This exception was already logged.
                    conn.close()
                    return
                except Exception:
                    gen_log.error("Uncaught exception", exc_info=True)
                    conn.close()
                    return
                if not ret:
                    return
                await asyncio.sleep(0)
        finally:
            delegate.on_close(self) 
开发者ID:opendevops-cn,项目名称:opendevops,代码行数:30,代码来源:http1connection.py

示例5: test_large_headers

# 需要导入模块: from tornado import iostream [as 别名]
# 或者: from tornado.iostream import UnsatisfiableReadError [as 别名]
def test_large_headers(self):
        with ExpectLog(gen_log, "Unsatisfiable read"):
            with self.assertRaises(UnsatisfiableReadError):
                self.fetch('/large', raise_error=True) 
开发者ID:tp4a,项目名称:teleport,代码行数:6,代码来源:simple_httpclient_test.py


注:本文中的tornado.iostream.UnsatisfiableReadError方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。