本文整理汇总了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)
示例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
示例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)
示例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)
示例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)