The Fix
Upgrade to version 0.7.2 or later.
Based on closed encode/httpx issue #80 · PR/commit linked
Production note: Most teams hit this during upgrades or environment changes. Roll out with a canary and smoke critical endpoints (health, OpenAPI/docs) before 100%.
@@ -46,6 +46,9 @@ async def send(
target = request.url.full_path.encode("ascii")
headers = request.headers.raw
+ if 'Host' not in request.headers:
+ host = request.url.authority.encode("ascii")
+ headers = [(b"host", host)] + headers
Option A — Upgrade to fixed release\nUpgrade to version 0.7.2 or later.\nWhen NOT to use: Do not use if it changes public behavior or if the failure cannot be reproduced.\n\n
Why This Fix Works in Production
- Trigger: HTTP/2 connection implementation is currently flaky.
- Mechanism: HTTP/2 connection mishandles the 'Host' header, causing timeout errors
- Why the fix works: Fixed an issue with HTTP/2 connection by not automatically setting the 'Host' header in requests. (first fixed release: 0.7.2).
- If left unfixed, the same config can fail only in production (env differences), causing startup failures or partial feature outages.
Why This Breaks in Prod
- Shows up under Python 3.7 in real deployments (not just unit tests).
- HTTP/2 connection mishandles the 'Host' header, causing timeout errors
- Surfaces as: File "/usr/local/lib/python3.7/dist-packages/httpcore/concurrency.py", line 65, in read\n self.stream_reader.read(n), timeout.read_timeout\n File…
Proof / Evidence
- GitHub issue: #80
- Fix PR: https://github.com/encode/httpx/pull/82
- First fixed release: 0.7.2
- Reproduced locally: No (not executed)
- Last verified: 2026-02-09
- Confidence: 0.85
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.29
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“@tomchristie I am trying to use the lib with Google Cloud services which use HTTP/2 and got hit by that, while trying to authenticate to…”
“Thanks folks. I should be able to review this on Tuesday.”
“Something that’d be really useful for us with debugging would be configuration on the client to determine which HTTP protocols should be supported”
“It's specifically an issue with HTTP/2 (doesn't reproduce if I switch the connection to force HTTP/1). Doesn't reproduce on all sites (eg. I'd be testing…”
Failure Signature (Search String)
- HTTP/2 connection implementation is currently flaky.
Error Message
Stack trace
Error Message
-------------
File "/usr/local/lib/python3.7/dist-packages/httpcore/concurrency.py", line 65, in read\n self.stream_reader.read(n), timeout.read_timeout\n File "/usr/lib/python3.7/asyncio/tasks.py", line 423, in wait_for\n raise futures.TimeoutError()\n concurrent.futures._base.TimeoutError
Stack trace
Error Message
-------------
File "/usr/local/lib/python3.7/dist-packages/httpcore/dispatch/connection_pool.py", line 114, in send\n request, stream=stream, ssl=ssl, timeout=timeout\n File "/usr/local/lib/python3.7/dist-packages/httpcore/dispatch/connection.py", line 53, in send\n request, stream=stream, timeout=timeout\n File "/usr/local/lib/python3.7/dist-packages/httpcore/dispatch/http2.py", line 77, in send\n await response.read()\n File "/usr/local/lib/python3.7/dist-packages/httpcore/models.py", line 684, in read\n self._content = b"".join([part async for part in self.stream()])\n File "/usr/local/lib/python3.7/dist-packages/httpcore/models.py", line 684, in <listcomp>\n self._content = b"".join([part async for part in self.stream()])\n File "/usr/local/lib/python3.7/dist-packages/httpcore/models.py", line 695, in stream\n async for chunk in self.raw():\n File "/usr/local/lib/python3.7/dist-packages/httpcore/models.py", line 712, in raw\n async for part in self._raw_stream:\n File "/usr/local/lib/python3.7/dist-packages/httpcore/dispatch/http2.py", line 121, in body_iter\n event = await self.receive_event(stream_id, timeout)\n File "/usr/local/lib/python3.7/dist-packages/httpcore/dispatch/http2.py", line 131, in receive_event\n data = await self.reader.read(self.READ_NUM_BYTES, timeout)\n File
... (truncated) ...
Stack trace
Error Message
-------------
File "/home/manatlan/Bureau/reqman/reqman.py", line 1414, in <module>\n httpcore.Client().get("https://www.google.com")\n File "/usr/local/lib/python3.7/dist-packages/httpcore/client.py", line 496, in get\n timeout=timeout,\n File "/usr/local/lib/python3.7/dist-packages/httpcore/client.py", line 472, in request\n timeout=timeout,\n File "/usr/local/lib/python3.7/dist-packages/httpcore/client.py", line 665, in send\n timeout=timeout,\n File "/usr/lib/python3.7/asyncio/base_events.py", line 573, in run_until_complete\n return future.result()\n File "/usr/local/lib/python3.7/dist-packages/httpcore/client.py", line 287, in send\n allow_redirects=allow_redirects,\n File "/usr/local/lib/python3.7/dist-packages/httpcore/client.py", line 313, in send_handling_redirects\n request, stream=stream, ssl=ssl, timeout=timeout\n File "/usr/local/lib/python3.7/dist-packages/httpcore/dispatch/connection_pool.py", line 117, in send\n self.active_connections.remove(connection)\n File "/usr/local/lib/python3.7/dist-packages/httpcore/dispatch/connection_pool.py", line 64, in remove\n del self.all[connection]\n KeyError: <httpcore.dispatch.connection.HTTPConnection object at 0x7fadbf88e0f0>
Environment
- Python: 3.7
What Broke
Requests to HTTP/2 endpoints result in ReadTimeout errors.
Why It Broke
HTTP/2 connection mishandles the 'Host' header, causing timeout errors
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
Upgrade to version 0.7.2 or later.
Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.
Fix reference: https://github.com/encode/httpx/pull/82
First fixed release: 0.7.2
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- Do not use if it changes public behavior or if the failure cannot be reproduced.
Did This Fix Work in Your Case?
Quick signal helps us prioritize which fixes to verify and improve.
Prevention
- Add a CI check that diffs key outputs after upgrades (OpenAPI schema snapshots, JSON payload shapes, CLI output).
- Upgrade behind a canary and run integration tests against the canary before 100% rollout.
- Add a TLS smoke test that performs a real handshake in CI (include CA bundle validation and hostname checks).
- Alert on handshake failures by error string and endpoint to catch cert/CA changes quickly.
Version Compatibility Table
| Version | Status |
|---|---|
| 0.7.2 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.