httpx2 2.13.0__tar.gz → 2.13.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. {httpx2-2.13.0 → httpx2-2.13.1}/CHANGELOG.md +9 -0
  2. {httpx2-2.13.0 → httpx2-2.13.1}/PKG-INFO +7 -13
  3. {httpx2-2.13.0 → httpx2-2.13.1}/httpx2/_content.py +2 -2
  4. {httpx2-2.13.0 → httpx2-2.13.1}/httpx2/_urls.py +1 -1
  5. {httpx2-2.13.0 → httpx2-2.13.1}/httpx2/_utils.py +12 -0
  6. {httpx2-2.13.0 → httpx2-2.13.1}/httpx2/websockets/_api.py +4 -1
  7. {httpx2-2.13.0 → httpx2-2.13.1}/.gitignore +0 -0
  8. {httpx2-2.13.0 → httpx2-2.13.1}/LICENSE.md +0 -0
  9. {httpx2-2.13.0 → httpx2-2.13.1}/README.md +0 -0
  10. {httpx2-2.13.0 → httpx2-2.13.1}/httpx2/__init__.py +0 -0
  11. {httpx2-2.13.0 → httpx2-2.13.1}/httpx2/__version__.py +0 -0
  12. {httpx2-2.13.0 → httpx2-2.13.1}/httpx2/_alias.py +0 -0
  13. {httpx2-2.13.0 → httpx2-2.13.1}/httpx2/_api.py +0 -0
  14. {httpx2-2.13.0 → httpx2-2.13.1}/httpx2/_auth.py +0 -0
  15. {httpx2-2.13.0 → httpx2-2.13.1}/httpx2/_client.py +0 -0
  16. {httpx2-2.13.0 → httpx2-2.13.1}/httpx2/_config.py +0 -0
  17. {httpx2-2.13.0 → httpx2-2.13.1}/httpx2/_decoders.py +0 -0
  18. {httpx2-2.13.0 → httpx2-2.13.1}/httpx2/_exceptions.py +0 -0
  19. {httpx2-2.13.0 → httpx2-2.13.1}/httpx2/_main.py +0 -0
  20. {httpx2-2.13.0 → httpx2-2.13.1}/httpx2/_models.py +0 -0
  21. {httpx2-2.13.0 → httpx2-2.13.1}/httpx2/_multipart.py +0 -0
  22. {httpx2-2.13.0 → httpx2-2.13.1}/httpx2/_sse.py +0 -0
  23. {httpx2-2.13.0 → httpx2-2.13.1}/httpx2/_status_codes.py +0 -0
  24. {httpx2-2.13.0 → httpx2-2.13.1}/httpx2/_transports/__init__.py +0 -0
  25. {httpx2-2.13.0 → httpx2-2.13.1}/httpx2/_transports/asgi.py +0 -0
  26. {httpx2-2.13.0 → httpx2-2.13.1}/httpx2/_transports/base.py +0 -0
  27. {httpx2-2.13.0 → httpx2-2.13.1}/httpx2/_transports/default.py +0 -0
  28. {httpx2-2.13.0 → httpx2-2.13.1}/httpx2/_transports/mock.py +0 -0
  29. {httpx2-2.13.0 → httpx2-2.13.1}/httpx2/_transports/wsgi.py +0 -0
  30. {httpx2-2.13.0 → httpx2-2.13.1}/httpx2/_types.py +0 -0
  31. {httpx2-2.13.0 → httpx2-2.13.1}/httpx2/_urlparse.py +0 -0
  32. {httpx2-2.13.0 → httpx2-2.13.1}/httpx2/py.typed +0 -0
  33. {httpx2-2.13.0 → httpx2-2.13.1}/httpx2/websockets/__init__.py +0 -0
  34. {httpx2-2.13.0 → httpx2-2.13.1}/httpx2/websockets/_exceptions.py +0 -0
  35. {httpx2-2.13.0 → httpx2-2.13.1}/httpx2/websockets/_ping.py +0 -0
  36. {httpx2-2.13.0 → httpx2-2.13.1}/httpx2/websockets/_transport.py +0 -0
  37. {httpx2-2.13.0 → httpx2-2.13.1}/pyproject.toml +0 -0
@@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
6
6
 
7
+ ## 2.13.1 (September 23rd, 2026)
8
+
9
+ ### Fixed
10
+
11
+ * Calculate `Content-Length` from the remaining bytes when a file is passed as `content=`, respecting its current position.
12
+ ([#1214](https://github.com/pydantic/httpx2/pull/1214))
13
+ * Stop the sync WebSocket keepalive thread cleanly when a ping races with connection shutdown.
14
+ ([#1228](https://github.com/pydantic/httpx2/pull/1228))
15
+
7
16
  ## 2.13.0 (September 14th, 2026)
8
17
 
9
18
  ### Changed
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: httpx2
3
- Version: 2.13.0
3
+ Version: 2.13.1
4
4
  Summary: The next generation HTTP client.
5
5
  Project-URL: Changelog, https://github.com/pydantic/httpx2/blob/main/src/httpx2/CHANGELOG.md
6
6
  Project-URL: Homepage, https://github.com/pydantic/httpx2
@@ -27,7 +27,7 @@ Classifier: Programming Language :: Python :: 3.15
27
27
  Classifier: Topic :: Internet :: WWW/HTTP
28
28
  Requires-Python: >=3.10
29
29
  Requires-Dist: anyio>=4.10; sys_platform != 'emscripten'
30
- Requires-Dist: httpcore2==2.13.0; sys_platform != 'emscripten'
30
+ Requires-Dist: httpcore2==2.13.1; sys_platform != 'emscripten'
31
31
  Requires-Dist: httpx2-jsfetch; sys_platform == 'emscripten' and python_version >= '3.12'
32
32
  Requires-Dist: idna>=3.18
33
33
  Requires-Dist: truststore>=0.10; sys_platform != 'emscripten'
@@ -213,20 +213,14 @@ inspiration around the lower-level networking details.
213
213
 
214
214
  ## Release Information
215
215
 
216
- ## 2.13.0 (September 14th, 2026)
217
-
218
- ### Changed
219
-
220
- * Require `brotlicffi` 1.2.0.2 or later for the `brotli` extra on non-CPython implementations.
221
- ([#1179](https://github.com/pydantic/httpx2/pull/1179))
216
+ ## 2.13.1 (September 23rd, 2026)
222
217
 
223
218
  ### Fixed
224
219
 
225
- * Make the `--no-verify` CLI flag disable TLS certificate verification and add an explicit `--verify` counterpart.
226
- ([#1140](https://github.com/pydantic/httpx2/pull/1140),
227
- [#1186](https://github.com/pydantic/httpx2/pull/1186))
228
- * Avoid nested async generator finalization errors when streamed responses are abandoned early.
229
- ([#1204](https://github.com/pydantic/httpx2/pull/1204))
220
+ * Calculate `Content-Length` from the remaining bytes when a file is passed as `content=`, respecting its current position.
221
+ ([#1214](https://github.com/pydantic/httpx2/pull/1214))
222
+ * Stop the sync WebSocket keepalive thread cleanly when a ping races with connection shutdown.
223
+ ([#1228](https://github.com/pydantic/httpx2/pull/1228))
230
224
 
231
225
  ---
232
226
 
@@ -19,7 +19,7 @@ from ._types import (
19
19
  ResponseContent,
20
20
  SyncByteStream,
21
21
  )
22
- from ._utils import peek_filelike_length, primitive_value_to_str
22
+ from ._utils import peek_filelike_remaining_length, primitive_value_to_str
23
23
 
24
24
  __all__ = ["ByteStream"]
25
25
 
@@ -119,7 +119,7 @@ def encode_content(
119
119
  # catches a case that's easy for users to make in error, and would
120
120
  # otherwise pass through here, like any other bytes-iterable,
121
121
  # because `dict` happens to be iterable. See issue #2491.
122
- content_length_or_none = peek_filelike_length(content)
122
+ content_length_or_none = peek_filelike_remaining_length(content)
123
123
 
124
124
  if content_length_or_none is None:
125
125
  headers = {"Transfer-Encoding": "chunked"}
@@ -34,7 +34,7 @@ class URL:
34
34
  assert url.port == 1234
35
35
  assert url.netloc == b"xn--mller-kva.de:1234"
36
36
  assert url.path == "/pa th"
37
- assert url.query == b"?search=ab"
37
+ assert url.query == b"search=ab"
38
38
  assert url.raw_path == b"/pa%20th?search=ab"
39
39
  assert url.fragment == "anchorlink"
40
40
 
@@ -115,6 +115,18 @@ def peek_filelike_length(stream: typing.Any) -> int | None:
115
115
  return length
116
116
 
117
117
 
118
+ def peek_filelike_remaining_length(stream: typing.Any) -> int | None:
119
+ """Return the remaining byte length without changing the stream position."""
120
+ try:
121
+ offset: int = stream.tell()
122
+ length: int = stream.seek(0, os.SEEK_END)
123
+ stream.seek(offset)
124
+ except (AttributeError, OSError):
125
+ return None
126
+
127
+ return max(0, length - offset)
128
+
129
+
118
130
  class URLPattern:
119
131
  """
120
132
  A utility class currently used for making lookups against proxy keys...
@@ -557,7 +557,10 @@ class WebSocketSession:
557
557
  should_close = self._wait_until_closed(self._should_close.wait, interval_seconds)
558
558
  if should_close: # pragma: no cover
559
559
  raise ShouldClose()
560
- pong_callback = self.ping()
560
+ try:
561
+ pong_callback = self.ping()
562
+ except wsproto.utilities.LocalProtocolError:
563
+ return
561
564
  if timeout_seconds is not None:
562
565
  acknowledged = self._wait_until_closed(pong_callback.wait, timeout_seconds)
563
566
  if not acknowledged:
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes