]> git.ipfire.org Git - thirdparty/httpx.git/commitdiff
Close proxy dispatch classes on Client.close() (#826)
authorTom Christie <tom@tomchristie.com>
Thu, 27 Feb 2020 20:41:28 +0000 (20:41 +0000)
committerGitHub <noreply@github.com>
Thu, 27 Feb 2020 20:41:28 +0000 (20:41 +0000)
httpx/_client.py

index 472d455953a9bf685223af6ae801e921842bfb80..7401a36fff63a48074f4cb7a003ea41233219b01 100644 (file)
@@ -862,6 +862,8 @@ class Client(BaseClient):
 
     def close(self) -> None:
         self.dispatch.close()
+        for proxy in self.proxies.values():
+            proxy.close()
 
     def __enter__(self) -> "Client":
         return self
@@ -1388,6 +1390,8 @@ class AsyncClient(BaseClient):
 
     async def aclose(self) -> None:
         await self.dispatch.close()
+        for proxy in self.proxies.values():
+            await proxy.close()
 
     async def __aenter__(self) -> "AsyncClient":
         return self