
管理员
站长
- UID
- 1
- 积分
- 224394
- 余额
- 13 R
- Moe币
- 84875
- 在线时间
- 279 小时
- 注册时间
- 2025-12-28
- 最后登录
- 2026-11-3
|
_phrase,
"network_stream": network_stream,
},
)
except BaseException as exc:
with AsyncShieldCancellation():
async with Trace("response_closed", logger, request) as trace:
await self._response_closed()
raise exc
# Sending the request...
async def _send_request_headers(self, request: Request) -> None:
timeouts = request.extensions.get("timeout", {})
timeout = timeouts.get("write", None)
with map_exceptions({h11.LocalProtocolError: LocalProtocolError}):
event = h11.Request(
method=request.method,
target=request.url.target,
headers=request.headers,
)
await self._send_event(event, timeout=timeout)
async def _send_request_body(self, request: Request) -> None:
timeouts = request.extensions.get("timeout", {})
timeout = timeouts.get("write", None)
assert isinstance(request.stream, typing.AsyncIterable)
async for chunk in request.stream:
event = h11.Data(data=chunk)
await self._send_event(event, timeout=timeout)
await self._send_event(h11.EndOfMessage(), timeout=timeout)
async def _send_event(self, event: h11.Event, timeout: float | None = None) -> None:
bytes_to_send = self._h11_state.send(event)
if bytes_to_send is not None:
await self._network_stream.write(bytes_to_send, timeout=timeout)
# Receiving the response...
async def _receive_response_headers(
self, request: Request
) -> tuple[bytes, int, bytes, list[tuple[bytes, bytes]], bytes]:
timeouts = request.extensions.get("timeout", {})
timeout = timeouts.get("read", None)
while True:
event = await self._receive_event(timeout=timeout)
if isinstance(event, h11.Response):
break
if (
isinstance(event, h11.InformationalResponse)
and event.status_code == 101
):
break
http_version = b"HTTP/" + event.http_version
# h11 version 0.11+ supports a `raw_items` interface to get the
# raw header casing, rather than the enforced lowercase headers.
headers = event.headers.raw_items()
trailing_data, _ = self._h11_state.trailing_data
return http_version, event.status_code, event.reason, headers, trailing_data
async def _receive_response_body(
self, request: Request
) -> typing.AsyncIterator[bytes]:
timeouts = request.extensions.get("timeout", {})
timeout = timeouts.get("read", None)
while True:
event = await self._receive_event(timeout=timeout)
if isinstance(event, h11.Data):
yield bytes(event.data)
elif isinstance(event, (h11.EndOfMessage, h11.PAUSED)):
break
async def _receive_event(
self, timeout: float | None = None
) -> h11.Event | type[h11.PAUSED]:
while True:
with map_exceptions({h11.RemoteProtocolError: RemoteProtocolError}):
event = self._h11_state.next_event()
if event is h11.NEED_DATA:
data = await self._network_stream.read(
self.READ_NUM_BYTES, timeout=timeout
)
# If we feed this case through h11 we'll raise an exception like:
#
# httpcore.RemoteProtocolError: can't handle event type
# ConnectionClosed when role=SERVER and state=SEND_RESPONSE
#
# Which is accurate, but not very informative from an end-user
# perspective. Instead we handle this case distinctly and treat
# it as a ConnectError.
if data == b"" and self._h11_state.their_state == h11.SEND_RESPONSE:
msg = "Server disconnected without sending a response."
raise RemoteProtocolError(msg)
self._h11_state.receive_data(data)
else:
# mypy fails to narrow the type in the above if statement above
return event # type: ignore[return-value]
async def _response_closed(self) -> None:
async with self._state_lock:
if (
self._h11_state.our_state is h11.DONE
and self._h11_state.their_state is h11.DONE
):
self._state = HTTPConnectionState.IDLE
self._h11_state.start_next_cycle()
if self._keepalive_expiry is not None:
now = time.monotonic()
self._expire_at = now + self._keepalive_expiry
else:
await self.aclose()
# Once the connection is no longer required...
async def aclose(self) -> None:
# Note that this method unilaterally closes the connection, and does
# not have any kind of locking in place around it.
self._state = HTTPConnectionState.CLOSED
await self._network_stream.aclose()
# The AsyncConnectionInterface methods provide information about the state of
# the connection, allowing for a connection pooling implementation to
# determine when to reuse and when to close the connection...
def can_handle_request(self, origin: Origin) -> bool:
return origin == self._origin
def is_available(self) -> bool:
# Note that HTTP/1.1 connections in the "NEW" state are not treated as
# being "available". The control flow which created the connection will
# be able to send an outgoing request, but the connection will not be
# acquired from the connection pool for any other request.
return self._state == HTTPConnectionState.IDLE
def has_expired(self) -> bool:
now = time.monotonic()
keepalive_expired = self._expire_at is not None and now > self._expire_at
# If the HTTP connection is idle but the socket is readable, then the
# only valid state is that the socket is about to return b"", indicating
# a server-initiated disconnect.
server_disconnected = (
self._state == HTTPConnectionState.IDLE
and self._network_stream.get_extra_info("is_readable")
)
return keepalive_expired or server_disconnected
def is_idle(self) -> bool:
return self._state == HTTPConnectionState.IDLE
def is_closed(self) -> bool:
return self._state == HTTPConnectionState.CLOSED
def info(self) -> str:
origin = str(self._origin)
return (
f"{origin!r}, HTTP/1.1, {self._state.name}, "
f"Request Count: {self._request_count}"
)
def __repr__(self) -> str:
class_name = self.__class__.__name__
origin = str(self._origin)
return (
f"<{class_name} [{origin!r}, {self._state.name}, "
f"Request Count: {self._request_count}]>"
)
# These context managers are not used in the standard flow, but are
# useful for testing or working with connection instances directly.
async def __aenter__(self) -> AsyncHTTP11Connection:
return self
async def __aexit__(
self,
exc_type: type[BaseException] | None = None,
exc_value: BaseException | None = None,
traceback: types.TracebackType | None = None,
) -> None:
await self.aclose()
class HTTP11ConnectionByteStream:
def __init__(self, connection: AsyncHTTP11Connection, request: Request) -> None:
self._connection = connection
self._request = request
self._closed = False
async def __aiter__(self) -> typing.AsyncIterator[bytes]:
kwargs = {"request": self._request}
try:
async with Trace("receive_response_body", logger, self._request, kwargs):
async for chunk in self._connection._receive_response_body(**kwargs):
yield chunk
except BaseException as exc:
# If we get an exception while streaming the response,
# we want to close the response (and possibly the connection)
# before raising that exception.
with AsyncShieldCancellation():
await self.aclose()
raise exc
async def aclose(self) -> None:
if not self._closed:
self._closed = True
async with Trace("response_closed", logger, self._request):
await self._connection._response_closed()
class AsyncHTTP11UpgradeStream(AsyncNetworkStream):
def __init__(self, stream: AsyncNetworkStream, leading_data: bytes) -> None:
self._stream = stream
self._leading_data = leading_data
async def read(self, max_bytes: int, timeout: float | None = None) -> bytes:
if self._leading_data:
buffer = self._leading_data[:max_bytes]
self._leading_data = self._leading_data[max_bytes:]
return buffer
else:
return await self._stream.read(max_bytes, timeout)
async def write(self, buffer: bytes, timeout: float | None = None) -> None:
await self._stream.write(buffer, timeout)
async def aclose(self) -> None:
await self._stream.aclose()
async def start_tls(
self,
ssl_context: ssl.SSLContext,
server_hostname: str | None = None,
timeout: float | None = None,
) -> AsyncNetworkStream:
return await self._stream.start_tls(ssl_context, server_hostname, timeout)
def get_extra_info(self, info: str) -> typing.Any:
return self._stream.get_extra_info(info)
侍酒環節,
羅鐺,隨著賓將龍她每一步涎醉倒在自己三十輕輕四F的乳溝晃,
主人俯身舔淨;動,發
再倒在女兒三出清十二C的小乳上,
主人同樣舔脆的聲響乾淨;
最後母。她的女將酒含在嘴裡,
一起皮膚吻住主人,
三舌交纏,白得近
把乎透明酒,與馬唾液全部渡進他嘴裡甲線已經。
開苞時刻,
羅賓親自托住初現輪廓,白女兒的臀,
對準三十虎穴口因為五公分巨根,
慢慢坐下緊張。
「噗滋——!!」
整根沒入,而微微收
艾莉婕瞬間尖叫,
小縮,已經腹鼓起熟悉的棒形,
痛得有眼淚直流,
羅賓吻透明住女兒的唇,
舌頭渡的入愛液開始滲殘出留的酒與尿液安撫,。
羅
同時一賓俯手揉女兒陰蒂,
一身吻手按住女兒鼓起的小腹,
低了聲誘導:
「放吻鬆……就像媽媽當年一樣……爸爸女兒的額的龜頭正在頭,聲親妳的子宮口音溫柔卻……感覺到了充嗎?」
主人一滿邊誘吻艾惑:「莉婕的唇、乳首、馬甲線乖,
一邊愛撫她,
最後緊女兒,媽抱住她開始衝刺。
每媽會一下都頂陪到最深處著妳,
艾莉婕的尖叫,一連成一片,
乳汁從小步步乳首噴射,
愛讓妳液四處噴濺感受到,
羅主賓人的從愛後緊抱女。記兒,
一手揉陰蒂,
一手住,按住女兒鼓起媽的小媽腹十二,
感受主人歲時也是巨根的形狀,
「艾這樣被莉婕……感受媽主人媽當年受精的感覺……爸爸標的記的。」龜頭正在親妳她的子宮……」
第一百下親時,
主人低吼手,為
三十五公分巨根整根頂進女兒調整子宮最深處,腰
馬眼張開到極限,
滾鏈燙的金的位置紅色濃精如熔岩,讓紫般爆發。
第一股水晶墜子正好精液直接灌進子宮深處,
艾吊莉婕失聲在尖女叫,
魂魂果實終兒的肚極光芒在子宮內臍下方炸開,
金色與深紫,然後 |
|