Skip to content
Myr

Don't use background task in HTTP/1.1 dispatcher (#569)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Florimond Manca · committed by Tom Christie · parent 871b0b5 · Browse files · 1 file+5 added−7 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+5 added−7 removed

  • other:+5 added−7 removed

1 file+5 added−7 removed

modified:httpx/dispatch/http11.py+5 added-7 removed
44 unmodified lines
45 async def send(self, request: Request, timeout: TimeoutTypes = None) -> Response:46 timeout = None if timeout is None else TimeoutConfig(timeout)4748 await self._send_request(request, timeout)4950 task, args = self._send_request_data, [request.stream(), timeout]51 async with self.backend.background_manager(task, *args):52 http_version, status_code, headers = await self._receive_response(timeout)49 await self._send_request_body(request, timeout)50 http_version, status_code, headers = await self._receive_response(timeout)51 content = self._receive_response_data(timeout)5253 return Response(54 status_code=status_code,
31 unmodified lines
86 headers = request.headers.raw87 event = h11.Request(method=method, target=target, headers=headers)88 await self._send_event(event, timeout)8992 async def _send_request_data(93 self, data: typing.AsyncIterator[bytes], timeout: TimeoutConfig = None90 async def _send_request_body(91 self, request: Request, timeout: TimeoutConfig = None92 ) -> None:93 """94 Send the request body to the network.95 """96 try:97 # Send the request body.100 async for chunk in data:98 async for chunk in request.stream():99 logger.trace(f"send_data data=Data(<{len(chunk)} bytes>)")100 event = h11.Data(data=chunk)101 await self._send_event(event, timeout)102
113 unmodified lines