httpcore2 2.9.1__tar.gz → 2.11.0__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.
- {httpcore2-2.9.1 → httpcore2-2.11.0}/CHANGELOG.md +22 -0
- {httpcore2-2.9.1 → httpcore2-2.11.0}/PKG-INFO +49 -26
- {httpcore2-2.9.1 → httpcore2-2.11.0}/README.md +23 -23
- {httpcore2-2.9.1 → httpcore2-2.11.0}/httpcore2/_async/http2.py +7 -5
- {httpcore2-2.9.1 → httpcore2-2.11.0}/httpcore2/_async/socks_proxy.py +1 -1
- {httpcore2-2.9.1 → httpcore2-2.11.0}/httpcore2/_sync/http2.py +7 -5
- {httpcore2-2.9.1 → httpcore2-2.11.0}/httpcore2/_sync/socks_proxy.py +1 -1
- {httpcore2-2.9.1 → httpcore2-2.11.0}/httpcore2/_synchronization.py +6 -3
- {httpcore2-2.9.1 → httpcore2-2.11.0}/pyproject.toml +3 -2
- {httpcore2-2.9.1 → httpcore2-2.11.0}/.gitignore +0 -0
- {httpcore2-2.9.1 → httpcore2-2.11.0}/LICENSE.md +0 -0
- {httpcore2-2.9.1 → httpcore2-2.11.0}/httpcore2/__init__.py +0 -0
- {httpcore2-2.9.1 → httpcore2-2.11.0}/httpcore2/_api.py +0 -0
- {httpcore2-2.9.1 → httpcore2-2.11.0}/httpcore2/_async/__init__.py +0 -0
- {httpcore2-2.9.1 → httpcore2-2.11.0}/httpcore2/_async/connection.py +0 -0
- {httpcore2-2.9.1 → httpcore2-2.11.0}/httpcore2/_async/connection_pool.py +0 -0
- {httpcore2-2.9.1 → httpcore2-2.11.0}/httpcore2/_async/http11.py +0 -0
- {httpcore2-2.9.1 → httpcore2-2.11.0}/httpcore2/_async/http_proxy.py +0 -0
- {httpcore2-2.9.1 → httpcore2-2.11.0}/httpcore2/_async/interfaces.py +0 -0
- {httpcore2-2.9.1 → httpcore2-2.11.0}/httpcore2/_backends/__init__.py +0 -0
- {httpcore2-2.9.1 → httpcore2-2.11.0}/httpcore2/_backends/anyio.py +0 -0
- {httpcore2-2.9.1 → httpcore2-2.11.0}/httpcore2/_backends/auto.py +0 -0
- {httpcore2-2.9.1 → httpcore2-2.11.0}/httpcore2/_backends/base.py +0 -0
- {httpcore2-2.9.1 → httpcore2-2.11.0}/httpcore2/_backends/mock.py +0 -0
- {httpcore2-2.9.1 → httpcore2-2.11.0}/httpcore2/_backends/sync.py +0 -0
- {httpcore2-2.9.1 → httpcore2-2.11.0}/httpcore2/_backends/trio.py +0 -0
- {httpcore2-2.9.1 → httpcore2-2.11.0}/httpcore2/_exceptions.py +0 -0
- {httpcore2-2.9.1 → httpcore2-2.11.0}/httpcore2/_models.py +0 -0
- {httpcore2-2.9.1 → httpcore2-2.11.0}/httpcore2/_ssl.py +0 -0
- {httpcore2-2.9.1 → httpcore2-2.11.0}/httpcore2/_sync/__init__.py +0 -0
- {httpcore2-2.9.1 → httpcore2-2.11.0}/httpcore2/_sync/connection.py +0 -0
- {httpcore2-2.9.1 → httpcore2-2.11.0}/httpcore2/_sync/connection_pool.py +0 -0
- {httpcore2-2.9.1 → httpcore2-2.11.0}/httpcore2/_sync/http11.py +0 -0
- {httpcore2-2.9.1 → httpcore2-2.11.0}/httpcore2/_sync/http_proxy.py +0 -0
- {httpcore2-2.9.1 → httpcore2-2.11.0}/httpcore2/_sync/interfaces.py +0 -0
- {httpcore2-2.9.1 → httpcore2-2.11.0}/httpcore2/_trace.py +0 -0
- {httpcore2-2.9.1 → httpcore2-2.11.0}/httpcore2/_utils.py +0 -0
- {httpcore2-2.9.1 → httpcore2-2.11.0}/httpcore2/py.typed +0 -0
|
@@ -4,6 +4,28 @@ 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.11.0 (August 18th, 2026)
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
* Cache sniffio availability instead of importing it on every synchronization call.
|
|
12
|
+
([#1132](https://github.com/pydantic/httpx2/pull/1132))
|
|
13
|
+
|
|
14
|
+
## 2.10.0 (August 9th, 2026)
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
|
|
18
|
+
* Add support for Python 3.15. ([#1090](https://github.com/pydantic/httpx2/pull/1090))
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
* Avoid quadratic copying when sending large HTTP/2 request bodies. ([#1127](https://github.com/pydantic/httpx2/pull/1127))
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
|
|
26
|
+
* Propagate the original exception instead of raising `KeyError` when an HTTP/2 stream fails. ([#1093](https://github.com/pydantic/httpx2/pull/1093))
|
|
27
|
+
* Start TLS for the `wss` scheme in SOCKS5 proxy connections. ([#1104](https://github.com/pydantic/httpx2/pull/1104))
|
|
28
|
+
|
|
7
29
|
## 2.9.1 (July 24th, 2026)
|
|
8
30
|
|
|
9
31
|
No changes since `2.9.0`. Version bumped to stay in lockstep with `httpx2`.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: httpcore2
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.11.0
|
|
4
4
|
Summary: A minimal low-level HTTP client.
|
|
5
5
|
Project-URL: Changelog, https://github.com/pydantic/httpx2/blob/main/src/httpcore2/CHANGELOG.md
|
|
6
6
|
Project-URL: Homepage, https://github.com/pydantic/httpx2
|
|
@@ -24,6 +24,7 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
24
24
|
Classifier: Programming Language :: Python :: 3.12
|
|
25
25
|
Classifier: Programming Language :: Python :: 3.13
|
|
26
26
|
Classifier: Programming Language :: Python :: 3.14
|
|
27
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
27
28
|
Classifier: Topic :: Internet :: WWW/HTTP
|
|
28
29
|
Requires-Python: >=3.10
|
|
29
30
|
Requires-Dist: h11>=0.16
|
|
@@ -35,17 +36,17 @@ Requires-Dist: h2<5,>=3; extra == 'http2'
|
|
|
35
36
|
Provides-Extra: socks
|
|
36
37
|
Requires-Dist: socksio==1.*; extra == 'socks'
|
|
37
38
|
Provides-Extra: trio
|
|
38
|
-
Requires-Dist: trio<1.0,>=0.
|
|
39
|
+
Requires-Dist: trio<1.0,>=0.33.0; extra == 'trio'
|
|
39
40
|
Description-Content-Type: text/markdown
|
|
40
41
|
|
|
41
|
-
#
|
|
42
|
+
# HTTPCore 2
|
|
42
43
|
|
|
43
|
-
[](https://github.com/pydantic/httpx2/actions)
|
|
45
|
+
[](https://pypi.org/project/httpcore2/)
|
|
45
46
|
|
|
46
47
|
> *Do one thing, and do it well.*
|
|
47
48
|
|
|
48
|
-
The
|
|
49
|
+
The HTTPCore 2 package provides a minimal low-level HTTP client, which does
|
|
49
50
|
one thing only. Sending HTTP requests.
|
|
50
51
|
|
|
51
52
|
It does not provide any high level model abstractions over the API,
|
|
@@ -54,7 +55,7 @@ transparent HTTP caching, URL parsing, session cookie handling,
|
|
|
54
55
|
content or charset decoding, handling JSON, environment based configuration
|
|
55
56
|
defaults, or any of that Jazz.
|
|
56
57
|
|
|
57
|
-
Some things
|
|
58
|
+
Some things HTTPCore 2 does do:
|
|
58
59
|
|
|
59
60
|
* Sending HTTP requests.
|
|
60
61
|
* Thread-safe / task-safe connection pooling.
|
|
@@ -68,13 +69,13 @@ Some things HTTP Core does do:
|
|
|
68
69
|
For HTTP/1.1 only support, install with:
|
|
69
70
|
|
|
70
71
|
```shell
|
|
71
|
-
pip install
|
|
72
|
+
pip install httpcore2
|
|
72
73
|
```
|
|
73
74
|
|
|
74
75
|
There are also a number of optional extras available...
|
|
75
76
|
|
|
76
77
|
```shell
|
|
77
|
-
pip install
|
|
78
|
+
pip install 'httpcore2[asyncio,trio,http2,socks]'
|
|
78
79
|
```
|
|
79
80
|
|
|
80
81
|
## Sending requests
|
|
@@ -82,9 +83,9 @@ pip install httpcore['asyncio,trio,http2,socks']
|
|
|
82
83
|
Send an HTTP request:
|
|
83
84
|
|
|
84
85
|
```python
|
|
85
|
-
import
|
|
86
|
+
import httpcore2
|
|
86
87
|
|
|
87
|
-
response =
|
|
88
|
+
response = httpcore2.request("GET", "https://www.example.com/")
|
|
88
89
|
|
|
89
90
|
print(response)
|
|
90
91
|
# <Response [200]>
|
|
@@ -96,25 +97,25 @@ print(response.content)
|
|
|
96
97
|
# b'<!doctype html>\n<html>\n<head>\n<title>Example Domain</title>\n\n<meta charset="utf-8"/>\n ...'
|
|
97
98
|
```
|
|
98
99
|
|
|
99
|
-
The top-level `
|
|
100
|
+
The top-level `httpcore2.request()` function is provided for convenience. In practice whenever you're working with `httpcore2` you'll want to use the connection pooling functionality that it provides.
|
|
100
101
|
|
|
101
102
|
```python
|
|
102
|
-
import
|
|
103
|
+
import httpcore2
|
|
103
104
|
|
|
104
|
-
http =
|
|
105
|
+
http = httpcore2.ConnectionPool()
|
|
105
106
|
response = http.request("GET", "https://www.example.com/")
|
|
106
107
|
```
|
|
107
108
|
|
|
108
|
-
Once you're ready to get going, [head over to the documentation](https://
|
|
109
|
+
Once you're ready to get going, [head over to the documentation](https://github.com/pydantic/httpx2/tree/main/src/httpcore2/docs).
|
|
109
110
|
|
|
110
111
|
## Motivation
|
|
111
112
|
|
|
112
|
-
You *probably* don't want to be using
|
|
113
|
+
You *probably* don't want to be using HTTPCore 2 directly. It might make sense if
|
|
113
114
|
you're writing something like a proxy service in Python, and you just want
|
|
114
115
|
something at the lowest possible level, but more typically you'll want to use
|
|
115
|
-
a higher level client library, such as `
|
|
116
|
+
a higher level client library, such as `httpx2`.
|
|
116
117
|
|
|
117
|
-
The motivation for `
|
|
118
|
+
The motivation for `httpcore2` is:
|
|
118
119
|
|
|
119
120
|
* To provide a reusable low-level client library, that other packages can then build on top of.
|
|
120
121
|
* To provide a *really clear interface split* between the networking code and client logic,
|
|
@@ -122,17 +123,17 @@ The motivation for `httpcore` is:
|
|
|
122
123
|
|
|
123
124
|
## Dependencies
|
|
124
125
|
|
|
125
|
-
The `
|
|
126
|
+
The `httpcore2` package has the following dependencies...
|
|
126
127
|
|
|
127
128
|
* `h11`
|
|
128
129
|
* `truststore`
|
|
129
130
|
|
|
130
131
|
And the following optional extras...
|
|
131
132
|
|
|
132
|
-
* `anyio` - Required by `pip install
|
|
133
|
-
* `trio` - Required by `pip install
|
|
134
|
-
* `h2` - Required by `pip install
|
|
135
|
-
* `socksio` - Required by `pip install
|
|
133
|
+
* `anyio` - Required by `pip install 'httpcore2[asyncio]'`.
|
|
134
|
+
* `trio` - Required by `pip install 'httpcore2[trio]'`.
|
|
135
|
+
* `h2` - Required by `pip install 'httpcore2[http2]'`.
|
|
136
|
+
* `socksio` - Required by `pip install 'httpcore2[socks]'`.
|
|
136
137
|
|
|
137
138
|
## Versioning
|
|
138
139
|
|
|
@@ -142,8 +143,8 @@ For changes between package versions please see our [project changelog](CHANGELO
|
|
|
142
143
|
|
|
143
144
|
We recommend pinning your requirements either the most current major version, or a more specific version range:
|
|
144
145
|
|
|
145
|
-
```
|
|
146
|
-
pip install '
|
|
146
|
+
```shell
|
|
147
|
+
pip install 'httpcore2==2.*'
|
|
147
148
|
```
|
|
148
149
|
# Changelog
|
|
149
150
|
|
|
@@ -151,6 +152,28 @@ All notable changes to this project will be documented in this file.
|
|
|
151
152
|
|
|
152
153
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
153
154
|
|
|
155
|
+
## 2.11.0 (August 18th, 2026)
|
|
156
|
+
|
|
157
|
+
### Changed
|
|
158
|
+
|
|
159
|
+
* Cache sniffio availability instead of importing it on every synchronization call.
|
|
160
|
+
([#1132](https://github.com/pydantic/httpx2/pull/1132))
|
|
161
|
+
|
|
162
|
+
## 2.10.0 (August 9th, 2026)
|
|
163
|
+
|
|
164
|
+
### Added
|
|
165
|
+
|
|
166
|
+
* Add support for Python 3.15. ([#1090](https://github.com/pydantic/httpx2/pull/1090))
|
|
167
|
+
|
|
168
|
+
### Changed
|
|
169
|
+
|
|
170
|
+
* Avoid quadratic copying when sending large HTTP/2 request bodies. ([#1127](https://github.com/pydantic/httpx2/pull/1127))
|
|
171
|
+
|
|
172
|
+
### Fixed
|
|
173
|
+
|
|
174
|
+
* Propagate the original exception instead of raising `KeyError` when an HTTP/2 stream fails. ([#1093](https://github.com/pydantic/httpx2/pull/1093))
|
|
175
|
+
* Start TLS for the `wss` scheme in SOCKS5 proxy connections. ([#1104](https://github.com/pydantic/httpx2/pull/1104))
|
|
176
|
+
|
|
154
177
|
## 2.9.1 (July 24th, 2026)
|
|
155
178
|
|
|
156
179
|
No changes since `2.9.0`. Version bumped to stay in lockstep with `httpx2`.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
#
|
|
1
|
+
# HTTPCore 2
|
|
2
2
|
|
|
3
|
-
[](https://github.com/pydantic/httpx2/actions)
|
|
4
|
+
[](https://pypi.org/project/httpcore2/)
|
|
5
5
|
|
|
6
6
|
> *Do one thing, and do it well.*
|
|
7
7
|
|
|
8
|
-
The
|
|
8
|
+
The HTTPCore 2 package provides a minimal low-level HTTP client, which does
|
|
9
9
|
one thing only. Sending HTTP requests.
|
|
10
10
|
|
|
11
11
|
It does not provide any high level model abstractions over the API,
|
|
@@ -14,7 +14,7 @@ transparent HTTP caching, URL parsing, session cookie handling,
|
|
|
14
14
|
content or charset decoding, handling JSON, environment based configuration
|
|
15
15
|
defaults, or any of that Jazz.
|
|
16
16
|
|
|
17
|
-
Some things
|
|
17
|
+
Some things HTTPCore 2 does do:
|
|
18
18
|
|
|
19
19
|
* Sending HTTP requests.
|
|
20
20
|
* Thread-safe / task-safe connection pooling.
|
|
@@ -28,13 +28,13 @@ Some things HTTP Core does do:
|
|
|
28
28
|
For HTTP/1.1 only support, install with:
|
|
29
29
|
|
|
30
30
|
```shell
|
|
31
|
-
pip install
|
|
31
|
+
pip install httpcore2
|
|
32
32
|
```
|
|
33
33
|
|
|
34
34
|
There are also a number of optional extras available...
|
|
35
35
|
|
|
36
36
|
```shell
|
|
37
|
-
pip install
|
|
37
|
+
pip install 'httpcore2[asyncio,trio,http2,socks]'
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
## Sending requests
|
|
@@ -42,9 +42,9 @@ pip install httpcore['asyncio,trio,http2,socks']
|
|
|
42
42
|
Send an HTTP request:
|
|
43
43
|
|
|
44
44
|
```python
|
|
45
|
-
import
|
|
45
|
+
import httpcore2
|
|
46
46
|
|
|
47
|
-
response =
|
|
47
|
+
response = httpcore2.request("GET", "https://www.example.com/")
|
|
48
48
|
|
|
49
49
|
print(response)
|
|
50
50
|
# <Response [200]>
|
|
@@ -56,25 +56,25 @@ print(response.content)
|
|
|
56
56
|
# b'<!doctype html>\n<html>\n<head>\n<title>Example Domain</title>\n\n<meta charset="utf-8"/>\n ...'
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
The top-level `
|
|
59
|
+
The top-level `httpcore2.request()` function is provided for convenience. In practice whenever you're working with `httpcore2` you'll want to use the connection pooling functionality that it provides.
|
|
60
60
|
|
|
61
61
|
```python
|
|
62
|
-
import
|
|
62
|
+
import httpcore2
|
|
63
63
|
|
|
64
|
-
http =
|
|
64
|
+
http = httpcore2.ConnectionPool()
|
|
65
65
|
response = http.request("GET", "https://www.example.com/")
|
|
66
66
|
```
|
|
67
67
|
|
|
68
|
-
Once you're ready to get going, [head over to the documentation](https://
|
|
68
|
+
Once you're ready to get going, [head over to the documentation](https://github.com/pydantic/httpx2/tree/main/src/httpcore2/docs).
|
|
69
69
|
|
|
70
70
|
## Motivation
|
|
71
71
|
|
|
72
|
-
You *probably* don't want to be using
|
|
72
|
+
You *probably* don't want to be using HTTPCore 2 directly. It might make sense if
|
|
73
73
|
you're writing something like a proxy service in Python, and you just want
|
|
74
74
|
something at the lowest possible level, but more typically you'll want to use
|
|
75
|
-
a higher level client library, such as `
|
|
75
|
+
a higher level client library, such as `httpx2`.
|
|
76
76
|
|
|
77
|
-
The motivation for `
|
|
77
|
+
The motivation for `httpcore2` is:
|
|
78
78
|
|
|
79
79
|
* To provide a reusable low-level client library, that other packages can then build on top of.
|
|
80
80
|
* To provide a *really clear interface split* between the networking code and client logic,
|
|
@@ -82,17 +82,17 @@ The motivation for `httpcore` is:
|
|
|
82
82
|
|
|
83
83
|
## Dependencies
|
|
84
84
|
|
|
85
|
-
The `
|
|
85
|
+
The `httpcore2` package has the following dependencies...
|
|
86
86
|
|
|
87
87
|
* `h11`
|
|
88
88
|
* `truststore`
|
|
89
89
|
|
|
90
90
|
And the following optional extras...
|
|
91
91
|
|
|
92
|
-
* `anyio` - Required by `pip install
|
|
93
|
-
* `trio` - Required by `pip install
|
|
94
|
-
* `h2` - Required by `pip install
|
|
95
|
-
* `socksio` - Required by `pip install
|
|
92
|
+
* `anyio` - Required by `pip install 'httpcore2[asyncio]'`.
|
|
93
|
+
* `trio` - Required by `pip install 'httpcore2[trio]'`.
|
|
94
|
+
* `h2` - Required by `pip install 'httpcore2[http2]'`.
|
|
95
|
+
* `socksio` - Required by `pip install 'httpcore2[socks]'`.
|
|
96
96
|
|
|
97
97
|
## Versioning
|
|
98
98
|
|
|
@@ -102,6 +102,6 @@ For changes between package versions please see our [project changelog](CHANGELO
|
|
|
102
102
|
|
|
103
103
|
We recommend pinning your requirements either the most current major version, or a more specific version range:
|
|
104
104
|
|
|
105
|
-
```
|
|
106
|
-
pip install '
|
|
105
|
+
```shell
|
|
106
|
+
pip install 'httpcore2==2.*'
|
|
107
107
|
```
|
|
@@ -246,10 +246,11 @@ class AsyncHTTP2Connection(AsyncConnectionInterface):
|
|
|
246
246
|
"""
|
|
247
247
|
Send a single chunk of data in one or more data frames.
|
|
248
248
|
"""
|
|
249
|
-
|
|
249
|
+
position = 0
|
|
250
|
+
while position < len(data):
|
|
250
251
|
max_flow = await self._wait_for_outgoing_flow(request, stream_id)
|
|
251
|
-
|
|
252
|
-
|
|
252
|
+
chunk = data[position : position + max_flow]
|
|
253
|
+
position += len(chunk)
|
|
253
254
|
self._h2_state.send_data(stream_id, chunk)
|
|
254
255
|
await self._write_outgoing_data(request)
|
|
255
256
|
|
|
@@ -373,9 +374,10 @@ class AsyncHTTP2Connection(AsyncConnectionInterface):
|
|
|
373
374
|
self._max_streams -= 1
|
|
374
375
|
|
|
375
376
|
async def _response_closed(self, stream_id: int) -> None:
|
|
376
|
-
await self._max_streams_semaphore.release()
|
|
377
377
|
async with self._state_lock:
|
|
378
|
-
|
|
378
|
+
if stream_id in self._events:
|
|
379
|
+
await self._max_streams_semaphore.release()
|
|
380
|
+
del self._events[stream_id]
|
|
379
381
|
if self._connection_terminated and not self._events:
|
|
380
382
|
await self.aclose()
|
|
381
383
|
|
|
@@ -240,7 +240,7 @@ class AsyncSocks5Connection(AsyncConnectionInterface):
|
|
|
240
240
|
trace.return_value = stream
|
|
241
241
|
|
|
242
242
|
# Upgrade the stream to SSL
|
|
243
|
-
if self._remote_origin.scheme
|
|
243
|
+
if self._remote_origin.scheme in (b"https", b"wss"):
|
|
244
244
|
ssl_context = default_ssl_context() if self._ssl_context is None else self._ssl_context
|
|
245
245
|
alpn_protocols = ["http/1.1", "h2"] if self._http2 else ["http/1.1"]
|
|
246
246
|
ssl_context.set_alpn_protocols(alpn_protocols)
|
|
@@ -246,10 +246,11 @@ class HTTP2Connection(ConnectionInterface):
|
|
|
246
246
|
"""
|
|
247
247
|
Send a single chunk of data in one or more data frames.
|
|
248
248
|
"""
|
|
249
|
-
|
|
249
|
+
position = 0
|
|
250
|
+
while position < len(data):
|
|
250
251
|
max_flow = self._wait_for_outgoing_flow(request, stream_id)
|
|
251
|
-
|
|
252
|
-
|
|
252
|
+
chunk = data[position : position + max_flow]
|
|
253
|
+
position += len(chunk)
|
|
253
254
|
self._h2_state.send_data(stream_id, chunk)
|
|
254
255
|
self._write_outgoing_data(request)
|
|
255
256
|
|
|
@@ -373,9 +374,10 @@ class HTTP2Connection(ConnectionInterface):
|
|
|
373
374
|
self._max_streams -= 1
|
|
374
375
|
|
|
375
376
|
def _response_closed(self, stream_id: int) -> None:
|
|
376
|
-
self._max_streams_semaphore.release()
|
|
377
377
|
with self._state_lock:
|
|
378
|
-
|
|
378
|
+
if stream_id in self._events:
|
|
379
|
+
self._max_streams_semaphore.release()
|
|
380
|
+
del self._events[stream_id]
|
|
379
381
|
if self._connection_terminated and not self._events:
|
|
380
382
|
self.close()
|
|
381
383
|
|
|
@@ -240,7 +240,7 @@ class Socks5Connection(ConnectionInterface):
|
|
|
240
240
|
trace.return_value = stream
|
|
241
241
|
|
|
242
242
|
# Upgrade the stream to SSL
|
|
243
|
-
if self._remote_origin.scheme
|
|
243
|
+
if self._remote_origin.scheme in (b"https", b"wss"):
|
|
244
244
|
ssl_context = default_ssl_context() if self._ssl_context is None else self._ssl_context
|
|
245
245
|
alpn_protocols = ["http/1.1", "h2"] if self._http2 else ["http/1.1"]
|
|
246
246
|
ssl_context.set_alpn_protocols(alpn_protocols)
|
|
@@ -18,13 +18,16 @@ try:
|
|
|
18
18
|
except ImportError: # pragma: no cover
|
|
19
19
|
anyio = None # type: ignore
|
|
20
20
|
|
|
21
|
+
try:
|
|
22
|
+
import sniffio
|
|
23
|
+
except ImportError: # pragma: no cover
|
|
24
|
+
sniffio = None # type: ignore
|
|
25
|
+
|
|
21
26
|
|
|
22
27
|
def current_async_library() -> str:
|
|
23
28
|
# Determine if we're running under trio or asyncio.
|
|
24
29
|
# See https://sniffio.readthedocs.io/en/latest/
|
|
25
|
-
|
|
26
|
-
import sniffio
|
|
27
|
-
except ImportError: # pragma: no cover
|
|
30
|
+
if sniffio is None: # pragma: no cover
|
|
28
31
|
environment = "asyncio"
|
|
29
32
|
else:
|
|
30
33
|
environment = sniffio.current_async_library()
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
requires = [
|
|
3
3
|
"hatchling",
|
|
4
4
|
"hatch-fancy-pypi-readme",
|
|
5
|
-
"uv-dynamic-versioning>=0.
|
|
5
|
+
"uv-dynamic-versioning>=0.14.0",
|
|
6
6
|
]
|
|
7
7
|
build-backend = "hatchling.build"
|
|
8
8
|
|
|
@@ -41,6 +41,7 @@ classifiers = [
|
|
|
41
41
|
"Programming Language :: Python :: 3.12",
|
|
42
42
|
"Programming Language :: Python :: 3.13",
|
|
43
43
|
"Programming Language :: Python :: 3.14",
|
|
44
|
+
"Programming Language :: Python :: 3.15",
|
|
44
45
|
"Topic :: Internet :: WWW/HTTP",
|
|
45
46
|
]
|
|
46
47
|
dependencies = ["truststore>=0.10", "h11>=0.16"]
|
|
@@ -48,7 +49,7 @@ dependencies = ["truststore>=0.10", "h11>=0.16"]
|
|
|
48
49
|
[project.optional-dependencies]
|
|
49
50
|
http2 = ["h2>=3,<5"]
|
|
50
51
|
socks = ["socksio==1.*"]
|
|
51
|
-
trio = ["trio>=0.
|
|
52
|
+
trio = ["trio>=0.33.0,<1.0"]
|
|
52
53
|
asyncio = ["anyio>=4.5.0,<5.0"]
|
|
53
54
|
|
|
54
55
|
[project.urls]
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|