rnet 2.4.2__cp313-cp313t-win_amd64.whl → 3.0.0rc10__cp313-cp313t-win_amd64.whl
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.
Potentially problematic release.
This version of rnet might be problematic. Click here for more details.
- rnet/__init__.py +11 -3
- rnet/__init__.pyi +1044 -799
- rnet/blocking.py +434 -1
- rnet/cookie.py +141 -1
- rnet/emulation.py +199 -0
- rnet/exceptions.py +224 -1
- rnet/header.py +319 -1
- rnet/http1.py +68 -0
- rnet/http2.py +361 -0
- rnet/rnet.cp313t-win_amd64.pyd +0 -0
- rnet/tls.py +428 -0
- rnet-3.0.0rc10.dist-info/METADATA +205 -0
- rnet-3.0.0rc10.dist-info/RECORD +16 -0
- {rnet-2.4.2.dist-info → rnet-3.0.0rc10.dist-info}/WHEEL +1 -1
- rnet-3.0.0rc10.dist-info/licenses/LICENSE +201 -0
- rnet/blocking.pyi +0 -616
- rnet/cookie.pyi +0 -76
- rnet/exceptions.pyi +0 -64
- rnet/header.pyi +0 -103
- rnet/impersonate.py +0 -1
- rnet/impersonate.pyi +0 -147
- rnet-2.4.2.dist-info/METADATA +0 -186
- rnet-2.4.2.dist-info/RECORD +0 -18
- rnet-2.4.2.dist-info/licenses/LICENSE +0 -674
rnet/http2.py
ADDED
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
"""
|
|
2
|
+
HTTP/2 connection configuration.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import datetime
|
|
6
|
+
from enum import Enum, auto
|
|
7
|
+
from typing import ClassVar, Self, TypedDict, NotRequired, Unpack, final
|
|
8
|
+
|
|
9
|
+
__all__ = [
|
|
10
|
+
"StreamId",
|
|
11
|
+
"StreamDependency",
|
|
12
|
+
"Priority",
|
|
13
|
+
"Priorities",
|
|
14
|
+
"PseudoId",
|
|
15
|
+
"PseudoOrder",
|
|
16
|
+
"SettingId",
|
|
17
|
+
"SettingsOrder",
|
|
18
|
+
"Params",
|
|
19
|
+
"Http2Options",
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
@final
|
|
24
|
+
class PseudoId(Enum):
|
|
25
|
+
"""
|
|
26
|
+
Represents the order of HTTP/2 pseudo-header fields in the header block.
|
|
27
|
+
|
|
28
|
+
HTTP/2 pseudo-header fields are a set of predefined header fields that start with ':'.
|
|
29
|
+
The order of these fields in a header block is significant. This enum defines the
|
|
30
|
+
possible pseudo-header fields and their standard order according to RFC 7540.
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
METHOD = auto()
|
|
34
|
+
SCHEME = auto()
|
|
35
|
+
AUTHORITY = auto()
|
|
36
|
+
PATH = auto()
|
|
37
|
+
PROTOCOL = auto()
|
|
38
|
+
STATUS = auto()
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
@final
|
|
42
|
+
class SettingId(Enum):
|
|
43
|
+
"""
|
|
44
|
+
An enum that lists all valid settings that can be sent in a SETTINGS frame.
|
|
45
|
+
|
|
46
|
+
Each setting has a value that is a 32 bit unsigned integer (6.5.1.).
|
|
47
|
+
|
|
48
|
+
See <https://datatracker.ietf.org/doc/html/rfc9113#name-defined-settings>.
|
|
49
|
+
"""
|
|
50
|
+
|
|
51
|
+
HEADER_TABLE_SIZE = auto()
|
|
52
|
+
"""
|
|
53
|
+
This setting allows the sender to inform the remote endpoint
|
|
54
|
+
of the maximum size of the compression table used to decode field blocks,
|
|
55
|
+
in units of octets. The encoder can select any size equal to or less than
|
|
56
|
+
this value by using signaling specific to the compression format inside
|
|
57
|
+
a field block (see [COMPRESSION]). The initial value is 4,096 octets.
|
|
58
|
+
|
|
59
|
+
[COMPRESSION]: <https://datatracker.ietf.org/doc/html/rfc7541>
|
|
60
|
+
"""
|
|
61
|
+
|
|
62
|
+
ENABLE_PUSH = auto()
|
|
63
|
+
"""
|
|
64
|
+
Enables or disables server push.
|
|
65
|
+
"""
|
|
66
|
+
|
|
67
|
+
MAX_CONCURRENT_STREAMS = auto()
|
|
68
|
+
"""
|
|
69
|
+
Specifies the maximum number of concurrent streams.
|
|
70
|
+
"""
|
|
71
|
+
|
|
72
|
+
INITIAL_WINDOW_SIZE = auto()
|
|
73
|
+
"""
|
|
74
|
+
Sets the initial stream-level flow control window size.
|
|
75
|
+
"""
|
|
76
|
+
|
|
77
|
+
MAX_FRAME_SIZE = auto()
|
|
78
|
+
"""
|
|
79
|
+
Indicates the largest acceptable frame payload size.
|
|
80
|
+
"""
|
|
81
|
+
|
|
82
|
+
MAX_HEADER_LIST_SIZE = auto()
|
|
83
|
+
"""
|
|
84
|
+
Advises the peer of the max field section size.
|
|
85
|
+
"""
|
|
86
|
+
|
|
87
|
+
ENABLE_CONNECT_PROTOCOL = auto()
|
|
88
|
+
"""
|
|
89
|
+
Enables support for the Extended CONNECT protocol.
|
|
90
|
+
"""
|
|
91
|
+
|
|
92
|
+
NO_RFC7540_PRIORITIES = auto()
|
|
93
|
+
"""
|
|
94
|
+
Disable RFC 7540 Stream Priorities.
|
|
95
|
+
[RFC 9218]: <https://www.rfc-editor.org/rfc/rfc9218.html#section-2.1>
|
|
96
|
+
"""
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
@final
|
|
100
|
+
class StreamId:
|
|
101
|
+
"""
|
|
102
|
+
A stream identifier, as described in [Section 5.1.1] of RFC 7540.
|
|
103
|
+
|
|
104
|
+
Streams are identified with an unsigned 31-bit integer. Streams
|
|
105
|
+
initiated by a client MUST use odd-numbered stream identifiers; those
|
|
106
|
+
initiated by the server MUST use even-numbered stream identifiers. A
|
|
107
|
+
stream identifier of zero (0x0) is used for connection control
|
|
108
|
+
messages; the stream identifier of zero cannot be used to establish a
|
|
109
|
+
new stream.
|
|
110
|
+
|
|
111
|
+
[Section 5.1.1]: https://tools.ietf.org/html/rfc7540#section-5.1.1
|
|
112
|
+
"""
|
|
113
|
+
|
|
114
|
+
ZERO: ClassVar[Self]
|
|
115
|
+
"""Stream ID 0."""
|
|
116
|
+
|
|
117
|
+
MAX: ClassVar[Self]
|
|
118
|
+
"""The maximum allowed stream ID."""
|
|
119
|
+
|
|
120
|
+
def __init__(self, src: int) -> None:
|
|
121
|
+
"""
|
|
122
|
+
Create a new StreamId.
|
|
123
|
+
"""
|
|
124
|
+
...
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
@final
|
|
128
|
+
class StreamDependency:
|
|
129
|
+
"""
|
|
130
|
+
Represents a stream dependency in HTTP/2 priority frames.
|
|
131
|
+
|
|
132
|
+
A stream dependency consists of three components:
|
|
133
|
+
* A stream identifier that the stream depends on
|
|
134
|
+
* A weight value between 0 and 255 (representing 1-256 in the protocol)
|
|
135
|
+
* An exclusive flag indicating whether this is an exclusive dependency
|
|
136
|
+
|
|
137
|
+
# Stream Dependencies
|
|
138
|
+
|
|
139
|
+
In HTTP/2, stream dependencies form a dependency tree where each stream
|
|
140
|
+
can depend on another stream. This creates a priority hierarchy that helps
|
|
141
|
+
determine the relative order in which streams should be processed.
|
|
142
|
+
"""
|
|
143
|
+
|
|
144
|
+
def __init__(
|
|
145
|
+
self, dependency_id: StreamId, weight: int, is_exclusive: bool
|
|
146
|
+
) -> None:
|
|
147
|
+
"""
|
|
148
|
+
Create a new StreamDependency.
|
|
149
|
+
"""
|
|
150
|
+
...
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
@final
|
|
154
|
+
class Priority:
|
|
155
|
+
"""
|
|
156
|
+
Represents an HTTP/2 PRIORITY frame (type=0x2).
|
|
157
|
+
|
|
158
|
+
The PRIORITY frame specifies the sender-advised priority of a stream,
|
|
159
|
+
as described in RFC 7540 Section 5.3. It can be sent in any stream state,
|
|
160
|
+
including idle or closed streams.
|
|
161
|
+
|
|
162
|
+
A PRIORITY frame consists of:
|
|
163
|
+
* The stream identifier whose priority is being set
|
|
164
|
+
* A StreamDependency object describing the dependency and weight
|
|
165
|
+
|
|
166
|
+
[Section 5.3]: https://tools.ietf.org/html/rfc7540#section-5.3
|
|
167
|
+
"""
|
|
168
|
+
|
|
169
|
+
def __init__(self, stream_id: StreamId, dependency: StreamDependency) -> None:
|
|
170
|
+
"""
|
|
171
|
+
Create a new Priority frame description.
|
|
172
|
+
"""
|
|
173
|
+
...
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
@final
|
|
177
|
+
class Priorities:
|
|
178
|
+
"""
|
|
179
|
+
A collection of HTTP/2 PRIORITY frames.
|
|
180
|
+
|
|
181
|
+
The Priorities class maintains an ordered list of Priority frames,
|
|
182
|
+
which can be used to represent and manage the stream dependency tree
|
|
183
|
+
in HTTP/2. This is useful for pre-configuring stream priorities or
|
|
184
|
+
sending multiple PRIORITY frames at once during connection setup or
|
|
185
|
+
stream reprioritization.
|
|
186
|
+
"""
|
|
187
|
+
|
|
188
|
+
def __init__(self, *priority: Priority) -> None:
|
|
189
|
+
"""
|
|
190
|
+
Create a new Priorities instance.
|
|
191
|
+
"""
|
|
192
|
+
...
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
@final
|
|
196
|
+
class PseudoOrder:
|
|
197
|
+
"""
|
|
198
|
+
Represents the order of HTTP/2 pseudo-header fields in the header block.
|
|
199
|
+
|
|
200
|
+
The PseudoOrder class maintains a list of PseudoId values that define
|
|
201
|
+
the order in which pseudo-header fields should appear in an HTTP/2
|
|
202
|
+
HEADERS frame. This is important because the order of pseudo-headers
|
|
203
|
+
is significant and must follow specific rules as defined in RFC 7540.
|
|
204
|
+
"""
|
|
205
|
+
|
|
206
|
+
def __init__(self, *pseudo_id: PseudoId) -> None:
|
|
207
|
+
"""
|
|
208
|
+
Create a new PseudoOrder instance.
|
|
209
|
+
"""
|
|
210
|
+
...
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
@final
|
|
214
|
+
class SettingsOrder:
|
|
215
|
+
"""
|
|
216
|
+
Represents the order of HTTP/2 settings parameters in the SETTINGS frame.
|
|
217
|
+
|
|
218
|
+
The SettingsOrder class maintains a list of SettingId values that define
|
|
219
|
+
the order in which settings parameters should appear in an HTTP/2
|
|
220
|
+
SETTINGS frame. While the order of settings is not strictly enforced
|
|
221
|
+
by the protocol, having a consistent order can help with readability
|
|
222
|
+
and debugging.
|
|
223
|
+
"""
|
|
224
|
+
|
|
225
|
+
def __init__(self, *setting_id: SettingId) -> None:
|
|
226
|
+
"""
|
|
227
|
+
Create a new SettingsOrder instance.
|
|
228
|
+
"""
|
|
229
|
+
...
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
class Params(TypedDict):
|
|
233
|
+
"""
|
|
234
|
+
All parameters for HTTP/2 connections.
|
|
235
|
+
"""
|
|
236
|
+
|
|
237
|
+
initial_window_size: NotRequired[int]
|
|
238
|
+
"""
|
|
239
|
+
Initial window size for HTTP/2 streams.
|
|
240
|
+
"""
|
|
241
|
+
|
|
242
|
+
initial_connection_window_size: NotRequired[int]
|
|
243
|
+
"""
|
|
244
|
+
Initial connection-level window size.
|
|
245
|
+
"""
|
|
246
|
+
|
|
247
|
+
initial_max_send_streams: NotRequired[int]
|
|
248
|
+
"""
|
|
249
|
+
Initial maximum number of send streams.
|
|
250
|
+
"""
|
|
251
|
+
|
|
252
|
+
initial_stream_id: NotRequired[int]
|
|
253
|
+
"""
|
|
254
|
+
Initial stream ID for the connection.
|
|
255
|
+
"""
|
|
256
|
+
|
|
257
|
+
adaptive_window: NotRequired[bool]
|
|
258
|
+
"""
|
|
259
|
+
Whether to use adaptive flow control.
|
|
260
|
+
"""
|
|
261
|
+
|
|
262
|
+
max_frame_size: NotRequired[int]
|
|
263
|
+
"""
|
|
264
|
+
Maximum frame size to use for HTTP/2.
|
|
265
|
+
"""
|
|
266
|
+
|
|
267
|
+
max_header_list_size: NotRequired[int]
|
|
268
|
+
"""
|
|
269
|
+
Maximum size of the header list.
|
|
270
|
+
"""
|
|
271
|
+
|
|
272
|
+
header_table_size: NotRequired[int]
|
|
273
|
+
"""
|
|
274
|
+
Header table size for HPACK compression.
|
|
275
|
+
"""
|
|
276
|
+
|
|
277
|
+
max_concurrent_streams: NotRequired[int]
|
|
278
|
+
"""
|
|
279
|
+
Maximum concurrent streams from remote peer.
|
|
280
|
+
"""
|
|
281
|
+
|
|
282
|
+
keep_alive_interval: NotRequired[datetime.timedelta]
|
|
283
|
+
"""
|
|
284
|
+
Interval for HTTP/2 keep-alive ping frames.
|
|
285
|
+
"""
|
|
286
|
+
|
|
287
|
+
keep_alive_timeout: NotRequired[datetime.timedelta]
|
|
288
|
+
"""
|
|
289
|
+
Timeout for keep-alive ping acknowledgements.
|
|
290
|
+
"""
|
|
291
|
+
|
|
292
|
+
keep_alive_while_idle: NotRequired[bool]
|
|
293
|
+
"""
|
|
294
|
+
Whether keep-alive applies while idle.
|
|
295
|
+
"""
|
|
296
|
+
|
|
297
|
+
enable_push: NotRequired[bool]
|
|
298
|
+
"""
|
|
299
|
+
Whether to enable push promises.
|
|
300
|
+
"""
|
|
301
|
+
|
|
302
|
+
enable_connect_protocol: NotRequired[bool]
|
|
303
|
+
"""
|
|
304
|
+
Whether to enable the CONNECT protocol.
|
|
305
|
+
"""
|
|
306
|
+
|
|
307
|
+
no_rfc7540_priorities: NotRequired[bool]
|
|
308
|
+
"""
|
|
309
|
+
Whether to disable RFC 7540 Stream Priorities.
|
|
310
|
+
"""
|
|
311
|
+
|
|
312
|
+
max_concurrent_reset_streams: NotRequired[int]
|
|
313
|
+
"""
|
|
314
|
+
Max concurrent locally reset streams.
|
|
315
|
+
"""
|
|
316
|
+
|
|
317
|
+
max_send_buf_size: NotRequired[int]
|
|
318
|
+
"""
|
|
319
|
+
Maximum send buffer size for streams.
|
|
320
|
+
"""
|
|
321
|
+
|
|
322
|
+
max_pending_accept_reset_streams: NotRequired[int]
|
|
323
|
+
"""
|
|
324
|
+
Max pending accept reset streams.
|
|
325
|
+
"""
|
|
326
|
+
|
|
327
|
+
headers_stream_dependency: NotRequired[StreamDependency]
|
|
328
|
+
"""
|
|
329
|
+
Stream dependency for outgoing HEADERS.
|
|
330
|
+
"""
|
|
331
|
+
|
|
332
|
+
headers_pseudo_order: NotRequired[PseudoOrder]
|
|
333
|
+
"""
|
|
334
|
+
Order of pseudo-header fields in HEADERS.
|
|
335
|
+
"""
|
|
336
|
+
|
|
337
|
+
settings_order: NotRequired[SettingsOrder]
|
|
338
|
+
"""
|
|
339
|
+
Order of settings parameters in SETTINGS frame.
|
|
340
|
+
"""
|
|
341
|
+
|
|
342
|
+
priorities: NotRequired[Priorities]
|
|
343
|
+
"""
|
|
344
|
+
List of PRIORITY frames to send after connection.
|
|
345
|
+
"""
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
@final
|
|
349
|
+
class Http2Options:
|
|
350
|
+
"""
|
|
351
|
+
Configuration for an HTTP/2 connection.
|
|
352
|
+
|
|
353
|
+
This struct defines various parameters to fine-tune the behavior of an HTTP/2 connection,
|
|
354
|
+
including stream management, window sizes, frame limits, and header config.
|
|
355
|
+
"""
|
|
356
|
+
|
|
357
|
+
def __init__(self, **kwargs: Unpack[Params]) -> None:
|
|
358
|
+
"""
|
|
359
|
+
Create a new Http2Options instance.
|
|
360
|
+
"""
|
|
361
|
+
...
|
rnet/rnet.cp313t-win_amd64.pyd
CHANGED
|
Binary file
|