httpdex-h3 0.1.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.
- httpdex_h3-0.1.0/Cargo.lock +704 -0
- httpdex_h3-0.1.0/Cargo.toml +3 -0
- httpdex_h3-0.1.0/PKG-INFO +33 -0
- httpdex_h3-0.1.0/README.md +23 -0
- httpdex_h3-0.1.0/crates/quic/Cargo.toml +14 -0
- httpdex_h3-0.1.0/crates/quic/README.md +5 -0
- httpdex_h3-0.1.0/crates/quic/src/lib.rs +336 -0
- httpdex_h3-0.1.0/httpdex_h3/__init__.py +10 -0
- httpdex_h3-0.1.0/httpdex_h3/_native_test.py +37 -0
- httpdex_h3-0.1.0/httpdex_h3/py.typed +0 -0
- httpdex_h3-0.1.0/pyproject.toml +58 -0
|
@@ -0,0 +1,704 @@
|
|
|
1
|
+
# This file is automatically @generated by Cargo.
|
|
2
|
+
# It is not intended for manual editing.
|
|
3
|
+
version = 4
|
|
4
|
+
|
|
5
|
+
[[package]]
|
|
6
|
+
name = "autocfg"
|
|
7
|
+
version = "1.5.0"
|
|
8
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
9
|
+
checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
|
|
10
|
+
|
|
11
|
+
[[package]]
|
|
12
|
+
name = "cc"
|
|
13
|
+
version = "1.2.57"
|
|
14
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
15
|
+
checksum = "7a0dd1ca384932ff3641c8718a02769f1698e7563dc6974ffd03346116310423"
|
|
16
|
+
dependencies = [
|
|
17
|
+
"find-msvc-tools",
|
|
18
|
+
"shlex",
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
[[package]]
|
|
22
|
+
name = "cfg-if"
|
|
23
|
+
version = "1.0.4"
|
|
24
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
25
|
+
checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
|
|
26
|
+
|
|
27
|
+
[[package]]
|
|
28
|
+
name = "cmake"
|
|
29
|
+
version = "0.1.57"
|
|
30
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
31
|
+
checksum = "75443c44cd6b379beb8c5b45d85d0773baf31cce901fe7bb252f4eff3008ef7d"
|
|
32
|
+
dependencies = [
|
|
33
|
+
"cc",
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
[[package]]
|
|
37
|
+
name = "displaydoc"
|
|
38
|
+
version = "0.2.5"
|
|
39
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
40
|
+
checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0"
|
|
41
|
+
dependencies = [
|
|
42
|
+
"proc-macro2",
|
|
43
|
+
"quote",
|
|
44
|
+
"syn",
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
[[package]]
|
|
48
|
+
name = "either"
|
|
49
|
+
version = "1.15.0"
|
|
50
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
51
|
+
checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
|
|
52
|
+
|
|
53
|
+
[[package]]
|
|
54
|
+
name = "enum_dispatch"
|
|
55
|
+
version = "0.3.13"
|
|
56
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
57
|
+
checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd"
|
|
58
|
+
dependencies = [
|
|
59
|
+
"once_cell",
|
|
60
|
+
"proc-macro2",
|
|
61
|
+
"quote",
|
|
62
|
+
"syn",
|
|
63
|
+
]
|
|
64
|
+
|
|
65
|
+
[[package]]
|
|
66
|
+
name = "find-msvc-tools"
|
|
67
|
+
version = "0.1.9"
|
|
68
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
69
|
+
checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582"
|
|
70
|
+
|
|
71
|
+
[[package]]
|
|
72
|
+
name = "form_urlencoded"
|
|
73
|
+
version = "1.2.2"
|
|
74
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
75
|
+
checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf"
|
|
76
|
+
dependencies = [
|
|
77
|
+
"percent-encoding",
|
|
78
|
+
]
|
|
79
|
+
|
|
80
|
+
[[package]]
|
|
81
|
+
name = "getrandom"
|
|
82
|
+
version = "0.2.17"
|
|
83
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
84
|
+
checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0"
|
|
85
|
+
dependencies = [
|
|
86
|
+
"cfg-if",
|
|
87
|
+
"libc",
|
|
88
|
+
"wasi",
|
|
89
|
+
]
|
|
90
|
+
|
|
91
|
+
[[package]]
|
|
92
|
+
name = "heck"
|
|
93
|
+
version = "0.5.0"
|
|
94
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
95
|
+
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
|
96
|
+
|
|
97
|
+
[[package]]
|
|
98
|
+
name = "httparse"
|
|
99
|
+
version = "1.10.1"
|
|
100
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
101
|
+
checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87"
|
|
102
|
+
|
|
103
|
+
[[package]]
|
|
104
|
+
name = "httpdex-h2"
|
|
105
|
+
version = "0.1.0"
|
|
106
|
+
dependencies = [
|
|
107
|
+
"pyo3",
|
|
108
|
+
]
|
|
109
|
+
|
|
110
|
+
[[package]]
|
|
111
|
+
name = "httpdex-parse"
|
|
112
|
+
version = "0.1.0"
|
|
113
|
+
dependencies = [
|
|
114
|
+
"httparse",
|
|
115
|
+
"pyo3",
|
|
116
|
+
"url",
|
|
117
|
+
]
|
|
118
|
+
|
|
119
|
+
[[package]]
|
|
120
|
+
name = "httpdex-quic"
|
|
121
|
+
version = "0.1.0"
|
|
122
|
+
dependencies = [
|
|
123
|
+
"pyo3",
|
|
124
|
+
"quiche",
|
|
125
|
+
"ring",
|
|
126
|
+
]
|
|
127
|
+
|
|
128
|
+
[[package]]
|
|
129
|
+
name = "icu_collections"
|
|
130
|
+
version = "2.1.1"
|
|
131
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
132
|
+
checksum = "4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43"
|
|
133
|
+
dependencies = [
|
|
134
|
+
"displaydoc",
|
|
135
|
+
"potential_utf",
|
|
136
|
+
"yoke",
|
|
137
|
+
"zerofrom",
|
|
138
|
+
"zerovec",
|
|
139
|
+
]
|
|
140
|
+
|
|
141
|
+
[[package]]
|
|
142
|
+
name = "icu_locale_core"
|
|
143
|
+
version = "2.1.1"
|
|
144
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
145
|
+
checksum = "edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6"
|
|
146
|
+
dependencies = [
|
|
147
|
+
"displaydoc",
|
|
148
|
+
"litemap",
|
|
149
|
+
"tinystr",
|
|
150
|
+
"writeable",
|
|
151
|
+
"zerovec",
|
|
152
|
+
]
|
|
153
|
+
|
|
154
|
+
[[package]]
|
|
155
|
+
name = "icu_normalizer"
|
|
156
|
+
version = "2.1.1"
|
|
157
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
158
|
+
checksum = "5f6c8828b67bf8908d82127b2054ea1b4427ff0230ee9141c54251934ab1b599"
|
|
159
|
+
dependencies = [
|
|
160
|
+
"icu_collections",
|
|
161
|
+
"icu_normalizer_data",
|
|
162
|
+
"icu_properties",
|
|
163
|
+
"icu_provider",
|
|
164
|
+
"smallvec",
|
|
165
|
+
"zerovec",
|
|
166
|
+
]
|
|
167
|
+
|
|
168
|
+
[[package]]
|
|
169
|
+
name = "icu_normalizer_data"
|
|
170
|
+
version = "2.1.1"
|
|
171
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
172
|
+
checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a"
|
|
173
|
+
|
|
174
|
+
[[package]]
|
|
175
|
+
name = "icu_properties"
|
|
176
|
+
version = "2.1.2"
|
|
177
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
178
|
+
checksum = "020bfc02fe870ec3a66d93e677ccca0562506e5872c650f893269e08615d74ec"
|
|
179
|
+
dependencies = [
|
|
180
|
+
"icu_collections",
|
|
181
|
+
"icu_locale_core",
|
|
182
|
+
"icu_properties_data",
|
|
183
|
+
"icu_provider",
|
|
184
|
+
"zerotrie",
|
|
185
|
+
"zerovec",
|
|
186
|
+
]
|
|
187
|
+
|
|
188
|
+
[[package]]
|
|
189
|
+
name = "icu_properties_data"
|
|
190
|
+
version = "2.1.2"
|
|
191
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
192
|
+
checksum = "616c294cf8d725c6afcd8f55abc17c56464ef6211f9ed59cccffe534129c77af"
|
|
193
|
+
|
|
194
|
+
[[package]]
|
|
195
|
+
name = "icu_provider"
|
|
196
|
+
version = "2.1.1"
|
|
197
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
198
|
+
checksum = "85962cf0ce02e1e0a629cc34e7ca3e373ce20dda4c4d7294bbd0bf1fdb59e614"
|
|
199
|
+
dependencies = [
|
|
200
|
+
"displaydoc",
|
|
201
|
+
"icu_locale_core",
|
|
202
|
+
"writeable",
|
|
203
|
+
"yoke",
|
|
204
|
+
"zerofrom",
|
|
205
|
+
"zerotrie",
|
|
206
|
+
"zerovec",
|
|
207
|
+
]
|
|
208
|
+
|
|
209
|
+
[[package]]
|
|
210
|
+
name = "idna"
|
|
211
|
+
version = "1.1.0"
|
|
212
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
213
|
+
checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de"
|
|
214
|
+
dependencies = [
|
|
215
|
+
"idna_adapter",
|
|
216
|
+
"smallvec",
|
|
217
|
+
"utf8_iter",
|
|
218
|
+
]
|
|
219
|
+
|
|
220
|
+
[[package]]
|
|
221
|
+
name = "idna_adapter"
|
|
222
|
+
version = "1.2.1"
|
|
223
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
224
|
+
checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344"
|
|
225
|
+
dependencies = [
|
|
226
|
+
"icu_normalizer",
|
|
227
|
+
"icu_properties",
|
|
228
|
+
]
|
|
229
|
+
|
|
230
|
+
[[package]]
|
|
231
|
+
name = "intrusive-collections"
|
|
232
|
+
version = "0.9.7"
|
|
233
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
234
|
+
checksum = "189d0897e4cbe8c75efedf3502c18c887b05046e59d28404d4d8e46cbc4d1e86"
|
|
235
|
+
dependencies = [
|
|
236
|
+
"memoffset",
|
|
237
|
+
]
|
|
238
|
+
|
|
239
|
+
[[package]]
|
|
240
|
+
name = "libc"
|
|
241
|
+
version = "0.2.183"
|
|
242
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
243
|
+
checksum = "b5b646652bf6661599e1da8901b3b9522896f01e736bad5f723fe7a3a27f899d"
|
|
244
|
+
|
|
245
|
+
[[package]]
|
|
246
|
+
name = "libm"
|
|
247
|
+
version = "0.2.16"
|
|
248
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
249
|
+
checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981"
|
|
250
|
+
|
|
251
|
+
[[package]]
|
|
252
|
+
name = "litemap"
|
|
253
|
+
version = "0.8.1"
|
|
254
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
255
|
+
checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77"
|
|
256
|
+
|
|
257
|
+
[[package]]
|
|
258
|
+
name = "log"
|
|
259
|
+
version = "0.4.29"
|
|
260
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
261
|
+
checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897"
|
|
262
|
+
|
|
263
|
+
[[package]]
|
|
264
|
+
name = "memoffset"
|
|
265
|
+
version = "0.9.1"
|
|
266
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
267
|
+
checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
|
|
268
|
+
dependencies = [
|
|
269
|
+
"autocfg",
|
|
270
|
+
]
|
|
271
|
+
|
|
272
|
+
[[package]]
|
|
273
|
+
name = "octets"
|
|
274
|
+
version = "0.3.5"
|
|
275
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
276
|
+
checksum = "8311fa8ab7a57759b4ff1f851a3048d9ef0effaa0130726426b742d26d8a88e7"
|
|
277
|
+
|
|
278
|
+
[[package]]
|
|
279
|
+
name = "once_cell"
|
|
280
|
+
version = "1.21.4"
|
|
281
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
282
|
+
checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
|
|
283
|
+
|
|
284
|
+
[[package]]
|
|
285
|
+
name = "percent-encoding"
|
|
286
|
+
version = "2.3.2"
|
|
287
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
288
|
+
checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220"
|
|
289
|
+
|
|
290
|
+
[[package]]
|
|
291
|
+
name = "portable-atomic"
|
|
292
|
+
version = "1.13.1"
|
|
293
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
294
|
+
checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49"
|
|
295
|
+
|
|
296
|
+
[[package]]
|
|
297
|
+
name = "potential_utf"
|
|
298
|
+
version = "0.1.4"
|
|
299
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
300
|
+
checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77"
|
|
301
|
+
dependencies = [
|
|
302
|
+
"zerovec",
|
|
303
|
+
]
|
|
304
|
+
|
|
305
|
+
[[package]]
|
|
306
|
+
name = "proc-macro2"
|
|
307
|
+
version = "1.0.106"
|
|
308
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
309
|
+
checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
|
|
310
|
+
dependencies = [
|
|
311
|
+
"unicode-ident",
|
|
312
|
+
]
|
|
313
|
+
|
|
314
|
+
[[package]]
|
|
315
|
+
name = "pyo3"
|
|
316
|
+
version = "0.28.2"
|
|
317
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
318
|
+
checksum = "cf85e27e86080aafd5a22eae58a162e133a589551542b3e5cee4beb27e54f8e1"
|
|
319
|
+
dependencies = [
|
|
320
|
+
"libc",
|
|
321
|
+
"once_cell",
|
|
322
|
+
"portable-atomic",
|
|
323
|
+
"pyo3-build-config",
|
|
324
|
+
"pyo3-ffi",
|
|
325
|
+
"pyo3-macros",
|
|
326
|
+
]
|
|
327
|
+
|
|
328
|
+
[[package]]
|
|
329
|
+
name = "pyo3-build-config"
|
|
330
|
+
version = "0.28.2"
|
|
331
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
332
|
+
checksum = "8bf94ee265674bf76c09fa430b0e99c26e319c945d96ca0d5a8215f31bf81cf7"
|
|
333
|
+
dependencies = [
|
|
334
|
+
"target-lexicon",
|
|
335
|
+
]
|
|
336
|
+
|
|
337
|
+
[[package]]
|
|
338
|
+
name = "pyo3-ffi"
|
|
339
|
+
version = "0.28.2"
|
|
340
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
341
|
+
checksum = "491aa5fc66d8059dd44a75f4580a2962c1862a1c2945359db36f6c2818b748dc"
|
|
342
|
+
dependencies = [
|
|
343
|
+
"libc",
|
|
344
|
+
"pyo3-build-config",
|
|
345
|
+
]
|
|
346
|
+
|
|
347
|
+
[[package]]
|
|
348
|
+
name = "pyo3-macros"
|
|
349
|
+
version = "0.28.2"
|
|
350
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
351
|
+
checksum = "f5d671734e9d7a43449f8480f8b38115df67bef8d21f76837fa75ee7aaa5e52e"
|
|
352
|
+
dependencies = [
|
|
353
|
+
"proc-macro2",
|
|
354
|
+
"pyo3-macros-backend",
|
|
355
|
+
"quote",
|
|
356
|
+
"syn",
|
|
357
|
+
]
|
|
358
|
+
|
|
359
|
+
[[package]]
|
|
360
|
+
name = "pyo3-macros-backend"
|
|
361
|
+
version = "0.28.2"
|
|
362
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
363
|
+
checksum = "22faaa1ce6c430a1f71658760497291065e6450d7b5dc2bcf254d49f66ee700a"
|
|
364
|
+
dependencies = [
|
|
365
|
+
"heck",
|
|
366
|
+
"proc-macro2",
|
|
367
|
+
"pyo3-build-config",
|
|
368
|
+
"quote",
|
|
369
|
+
"syn",
|
|
370
|
+
]
|
|
371
|
+
|
|
372
|
+
[[package]]
|
|
373
|
+
name = "quiche"
|
|
374
|
+
version = "0.24.9"
|
|
375
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
376
|
+
checksum = "ba053386c3a3b16441cb8a34574f91a9178fd3d813c0639514fcd8e4f274a44b"
|
|
377
|
+
dependencies = [
|
|
378
|
+
"cmake",
|
|
379
|
+
"either",
|
|
380
|
+
"enum_dispatch",
|
|
381
|
+
"intrusive-collections",
|
|
382
|
+
"libc",
|
|
383
|
+
"libm",
|
|
384
|
+
"log",
|
|
385
|
+
"octets",
|
|
386
|
+
"slab",
|
|
387
|
+
"smallvec",
|
|
388
|
+
"windows-sys 0.59.0",
|
|
389
|
+
]
|
|
390
|
+
|
|
391
|
+
[[package]]
|
|
392
|
+
name = "quote"
|
|
393
|
+
version = "1.0.45"
|
|
394
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
395
|
+
checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924"
|
|
396
|
+
dependencies = [
|
|
397
|
+
"proc-macro2",
|
|
398
|
+
]
|
|
399
|
+
|
|
400
|
+
[[package]]
|
|
401
|
+
name = "ring"
|
|
402
|
+
version = "0.17.14"
|
|
403
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
404
|
+
checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7"
|
|
405
|
+
dependencies = [
|
|
406
|
+
"cc",
|
|
407
|
+
"cfg-if",
|
|
408
|
+
"getrandom",
|
|
409
|
+
"libc",
|
|
410
|
+
"untrusted",
|
|
411
|
+
"windows-sys 0.52.0",
|
|
412
|
+
]
|
|
413
|
+
|
|
414
|
+
[[package]]
|
|
415
|
+
name = "serde"
|
|
416
|
+
version = "1.0.228"
|
|
417
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
418
|
+
checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"
|
|
419
|
+
dependencies = [
|
|
420
|
+
"serde_core",
|
|
421
|
+
]
|
|
422
|
+
|
|
423
|
+
[[package]]
|
|
424
|
+
name = "serde_core"
|
|
425
|
+
version = "1.0.228"
|
|
426
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
427
|
+
checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"
|
|
428
|
+
dependencies = [
|
|
429
|
+
"serde_derive",
|
|
430
|
+
]
|
|
431
|
+
|
|
432
|
+
[[package]]
|
|
433
|
+
name = "serde_derive"
|
|
434
|
+
version = "1.0.228"
|
|
435
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
436
|
+
checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
|
|
437
|
+
dependencies = [
|
|
438
|
+
"proc-macro2",
|
|
439
|
+
"quote",
|
|
440
|
+
"syn",
|
|
441
|
+
]
|
|
442
|
+
|
|
443
|
+
[[package]]
|
|
444
|
+
name = "shlex"
|
|
445
|
+
version = "1.3.0"
|
|
446
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
447
|
+
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
|
448
|
+
|
|
449
|
+
[[package]]
|
|
450
|
+
name = "slab"
|
|
451
|
+
version = "0.4.12"
|
|
452
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
453
|
+
checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
|
|
454
|
+
|
|
455
|
+
[[package]]
|
|
456
|
+
name = "smallvec"
|
|
457
|
+
version = "1.15.1"
|
|
458
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
459
|
+
checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
|
|
460
|
+
|
|
461
|
+
[[package]]
|
|
462
|
+
name = "stable_deref_trait"
|
|
463
|
+
version = "1.2.1"
|
|
464
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
465
|
+
checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596"
|
|
466
|
+
|
|
467
|
+
[[package]]
|
|
468
|
+
name = "syn"
|
|
469
|
+
version = "2.0.117"
|
|
470
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
471
|
+
checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99"
|
|
472
|
+
dependencies = [
|
|
473
|
+
"proc-macro2",
|
|
474
|
+
"quote",
|
|
475
|
+
"unicode-ident",
|
|
476
|
+
]
|
|
477
|
+
|
|
478
|
+
[[package]]
|
|
479
|
+
name = "synstructure"
|
|
480
|
+
version = "0.13.2"
|
|
481
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
482
|
+
checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2"
|
|
483
|
+
dependencies = [
|
|
484
|
+
"proc-macro2",
|
|
485
|
+
"quote",
|
|
486
|
+
"syn",
|
|
487
|
+
]
|
|
488
|
+
|
|
489
|
+
[[package]]
|
|
490
|
+
name = "target-lexicon"
|
|
491
|
+
version = "0.13.5"
|
|
492
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
493
|
+
checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca"
|
|
494
|
+
|
|
495
|
+
[[package]]
|
|
496
|
+
name = "tinystr"
|
|
497
|
+
version = "0.8.2"
|
|
498
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
499
|
+
checksum = "42d3e9c45c09de15d06dd8acf5f4e0e399e85927b7f00711024eb7ae10fa4869"
|
|
500
|
+
dependencies = [
|
|
501
|
+
"displaydoc",
|
|
502
|
+
"zerovec",
|
|
503
|
+
]
|
|
504
|
+
|
|
505
|
+
[[package]]
|
|
506
|
+
name = "unicode-ident"
|
|
507
|
+
version = "1.0.24"
|
|
508
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
509
|
+
checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
|
|
510
|
+
|
|
511
|
+
[[package]]
|
|
512
|
+
name = "untrusted"
|
|
513
|
+
version = "0.9.0"
|
|
514
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
515
|
+
checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
|
|
516
|
+
|
|
517
|
+
[[package]]
|
|
518
|
+
name = "url"
|
|
519
|
+
version = "2.5.8"
|
|
520
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
521
|
+
checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed"
|
|
522
|
+
dependencies = [
|
|
523
|
+
"form_urlencoded",
|
|
524
|
+
"idna",
|
|
525
|
+
"percent-encoding",
|
|
526
|
+
"serde",
|
|
527
|
+
]
|
|
528
|
+
|
|
529
|
+
[[package]]
|
|
530
|
+
name = "utf8_iter"
|
|
531
|
+
version = "1.0.4"
|
|
532
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
533
|
+
checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"
|
|
534
|
+
|
|
535
|
+
[[package]]
|
|
536
|
+
name = "wasi"
|
|
537
|
+
version = "0.11.1+wasi-snapshot-preview1"
|
|
538
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
539
|
+
checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
|
|
540
|
+
|
|
541
|
+
[[package]]
|
|
542
|
+
name = "windows-sys"
|
|
543
|
+
version = "0.52.0"
|
|
544
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
545
|
+
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
|
|
546
|
+
dependencies = [
|
|
547
|
+
"windows-targets",
|
|
548
|
+
]
|
|
549
|
+
|
|
550
|
+
[[package]]
|
|
551
|
+
name = "windows-sys"
|
|
552
|
+
version = "0.59.0"
|
|
553
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
554
|
+
checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
|
|
555
|
+
dependencies = [
|
|
556
|
+
"windows-targets",
|
|
557
|
+
]
|
|
558
|
+
|
|
559
|
+
[[package]]
|
|
560
|
+
name = "windows-targets"
|
|
561
|
+
version = "0.52.6"
|
|
562
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
563
|
+
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
|
|
564
|
+
dependencies = [
|
|
565
|
+
"windows_aarch64_gnullvm",
|
|
566
|
+
"windows_aarch64_msvc",
|
|
567
|
+
"windows_i686_gnu",
|
|
568
|
+
"windows_i686_gnullvm",
|
|
569
|
+
"windows_i686_msvc",
|
|
570
|
+
"windows_x86_64_gnu",
|
|
571
|
+
"windows_x86_64_gnullvm",
|
|
572
|
+
"windows_x86_64_msvc",
|
|
573
|
+
]
|
|
574
|
+
|
|
575
|
+
[[package]]
|
|
576
|
+
name = "windows_aarch64_gnullvm"
|
|
577
|
+
version = "0.52.6"
|
|
578
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
579
|
+
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
|
|
580
|
+
|
|
581
|
+
[[package]]
|
|
582
|
+
name = "windows_aarch64_msvc"
|
|
583
|
+
version = "0.52.6"
|
|
584
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
585
|
+
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
|
|
586
|
+
|
|
587
|
+
[[package]]
|
|
588
|
+
name = "windows_i686_gnu"
|
|
589
|
+
version = "0.52.6"
|
|
590
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
591
|
+
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
|
|
592
|
+
|
|
593
|
+
[[package]]
|
|
594
|
+
name = "windows_i686_gnullvm"
|
|
595
|
+
version = "0.52.6"
|
|
596
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
597
|
+
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
|
|
598
|
+
|
|
599
|
+
[[package]]
|
|
600
|
+
name = "windows_i686_msvc"
|
|
601
|
+
version = "0.52.6"
|
|
602
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
603
|
+
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
|
|
604
|
+
|
|
605
|
+
[[package]]
|
|
606
|
+
name = "windows_x86_64_gnu"
|
|
607
|
+
version = "0.52.6"
|
|
608
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
609
|
+
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
|
|
610
|
+
|
|
611
|
+
[[package]]
|
|
612
|
+
name = "windows_x86_64_gnullvm"
|
|
613
|
+
version = "0.52.6"
|
|
614
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
615
|
+
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
|
|
616
|
+
|
|
617
|
+
[[package]]
|
|
618
|
+
name = "windows_x86_64_msvc"
|
|
619
|
+
version = "0.52.6"
|
|
620
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
621
|
+
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
|
622
|
+
|
|
623
|
+
[[package]]
|
|
624
|
+
name = "writeable"
|
|
625
|
+
version = "0.6.2"
|
|
626
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
627
|
+
checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9"
|
|
628
|
+
|
|
629
|
+
[[package]]
|
|
630
|
+
name = "yoke"
|
|
631
|
+
version = "0.8.1"
|
|
632
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
633
|
+
checksum = "72d6e5c6afb84d73944e5cedb052c4680d5657337201555f9f2a16b7406d4954"
|
|
634
|
+
dependencies = [
|
|
635
|
+
"stable_deref_trait",
|
|
636
|
+
"yoke-derive",
|
|
637
|
+
"zerofrom",
|
|
638
|
+
]
|
|
639
|
+
|
|
640
|
+
[[package]]
|
|
641
|
+
name = "yoke-derive"
|
|
642
|
+
version = "0.8.1"
|
|
643
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
644
|
+
checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d"
|
|
645
|
+
dependencies = [
|
|
646
|
+
"proc-macro2",
|
|
647
|
+
"quote",
|
|
648
|
+
"syn",
|
|
649
|
+
"synstructure",
|
|
650
|
+
]
|
|
651
|
+
|
|
652
|
+
[[package]]
|
|
653
|
+
name = "zerofrom"
|
|
654
|
+
version = "0.1.6"
|
|
655
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
656
|
+
checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5"
|
|
657
|
+
dependencies = [
|
|
658
|
+
"zerofrom-derive",
|
|
659
|
+
]
|
|
660
|
+
|
|
661
|
+
[[package]]
|
|
662
|
+
name = "zerofrom-derive"
|
|
663
|
+
version = "0.1.6"
|
|
664
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
665
|
+
checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502"
|
|
666
|
+
dependencies = [
|
|
667
|
+
"proc-macro2",
|
|
668
|
+
"quote",
|
|
669
|
+
"syn",
|
|
670
|
+
"synstructure",
|
|
671
|
+
]
|
|
672
|
+
|
|
673
|
+
[[package]]
|
|
674
|
+
name = "zerotrie"
|
|
675
|
+
version = "0.2.3"
|
|
676
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
677
|
+
checksum = "2a59c17a5562d507e4b54960e8569ebee33bee890c70aa3fe7b97e85a9fd7851"
|
|
678
|
+
dependencies = [
|
|
679
|
+
"displaydoc",
|
|
680
|
+
"yoke",
|
|
681
|
+
"zerofrom",
|
|
682
|
+
]
|
|
683
|
+
|
|
684
|
+
[[package]]
|
|
685
|
+
name = "zerovec"
|
|
686
|
+
version = "0.11.5"
|
|
687
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
688
|
+
checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002"
|
|
689
|
+
dependencies = [
|
|
690
|
+
"yoke",
|
|
691
|
+
"zerofrom",
|
|
692
|
+
"zerovec-derive",
|
|
693
|
+
]
|
|
694
|
+
|
|
695
|
+
[[package]]
|
|
696
|
+
name = "zerovec-derive"
|
|
697
|
+
version = "0.11.2"
|
|
698
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
699
|
+
checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3"
|
|
700
|
+
dependencies = [
|
|
701
|
+
"proc-macro2",
|
|
702
|
+
"quote",
|
|
703
|
+
"syn",
|
|
704
|
+
]
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: httpdex-h3
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: HTTP/3 client via QUIC (quiche) with PyO3 bindings.
|
|
5
|
+
Author: Marcelo Trylesinski
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Requires-Python: >=3.10
|
|
8
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
9
|
+
|
|
10
|
+
# httpdex-h3
|
|
11
|
+
|
|
12
|
+
HTTP/3 and QUIC bindings for the `httpdex` workspace.
|
|
13
|
+
|
|
14
|
+
`httpdex-h3` exposes the low-level HTTP/3 connection objects used by `httpdex-core`, with a native implementation backed by QUIC support from the Rust side of this repository.
|
|
15
|
+
|
|
16
|
+
## Highlights
|
|
17
|
+
|
|
18
|
+
- HTTP/3 connection support
|
|
19
|
+
- QUIC configuration via `QuicConfig`
|
|
20
|
+
- Native extension for performance-sensitive protocol work
|
|
21
|
+
- Small API intended for transport-layer integration
|
|
22
|
+
|
|
23
|
+
## Public API
|
|
24
|
+
|
|
25
|
+
- `H3Connection`
|
|
26
|
+
- `H3Event`
|
|
27
|
+
- `H3Header`
|
|
28
|
+
- `QuicConfig`
|
|
29
|
+
|
|
30
|
+
## Role In The Workspace
|
|
31
|
+
|
|
32
|
+
`httpdex-core` uses this package to implement HTTP/3 request/response handling.
|
|
33
|
+
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# httpdex-h3
|
|
2
|
+
|
|
3
|
+
HTTP/3 and QUIC bindings for the `httpdex` workspace.
|
|
4
|
+
|
|
5
|
+
`httpdex-h3` exposes the low-level HTTP/3 connection objects used by `httpdex-core`, with a native implementation backed by QUIC support from the Rust side of this repository.
|
|
6
|
+
|
|
7
|
+
## Highlights
|
|
8
|
+
|
|
9
|
+
- HTTP/3 connection support
|
|
10
|
+
- QUIC configuration via `QuicConfig`
|
|
11
|
+
- Native extension for performance-sensitive protocol work
|
|
12
|
+
- Small API intended for transport-layer integration
|
|
13
|
+
|
|
14
|
+
## Public API
|
|
15
|
+
|
|
16
|
+
- `H3Connection`
|
|
17
|
+
- `H3Event`
|
|
18
|
+
- `H3Header`
|
|
19
|
+
- `QuicConfig`
|
|
20
|
+
|
|
21
|
+
## Role In The Workspace
|
|
22
|
+
|
|
23
|
+
`httpdex-core` uses this package to implement HTTP/3 request/response handling.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "httpdex-quic"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
edition = "2021"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
|
|
7
|
+
[lib]
|
|
8
|
+
name = "httpdex_quic_native"
|
|
9
|
+
crate-type = ["cdylib"]
|
|
10
|
+
|
|
11
|
+
[dependencies]
|
|
12
|
+
pyo3 = { version = "0.28", features = ["extension-module"] }
|
|
13
|
+
quiche = "0.24"
|
|
14
|
+
ring = "0.17"
|
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
use pyo3::exceptions::{PyConnectionError, PyValueError};
|
|
2
|
+
use pyo3::prelude::*;
|
|
3
|
+
use pyo3::types::{PyBytes, PyList};
|
|
4
|
+
use quiche::h3::NameValue;
|
|
5
|
+
|
|
6
|
+
use std::net::SocketAddr;
|
|
7
|
+
|
|
8
|
+
const MAX_DATAGRAM_SIZE: usize = 1350;
|
|
9
|
+
|
|
10
|
+
/// Configuration for a QUIC connection.
|
|
11
|
+
#[pyclass]
|
|
12
|
+
struct QuicConfig {
|
|
13
|
+
inner: quiche::Config,
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
#[pymethods]
|
|
17
|
+
impl QuicConfig {
|
|
18
|
+
#[new]
|
|
19
|
+
fn new() -> PyResult<Self> {
|
|
20
|
+
let mut config =
|
|
21
|
+
quiche::Config::new(quiche::PROTOCOL_VERSION).map_err(|e| PyValueError::new_err(format!("{e}")))?;
|
|
22
|
+
|
|
23
|
+
// Set ALPN for HTTP/3.
|
|
24
|
+
config
|
|
25
|
+
.set_application_protos(quiche::h3::APPLICATION_PROTOCOL)
|
|
26
|
+
.map_err(|e| PyValueError::new_err(format!("{e}")))?;
|
|
27
|
+
|
|
28
|
+
// Reasonable defaults for a client.
|
|
29
|
+
config.set_max_idle_timeout(30_000);
|
|
30
|
+
config.set_max_recv_udp_payload_size(MAX_DATAGRAM_SIZE);
|
|
31
|
+
config.set_max_send_udp_payload_size(MAX_DATAGRAM_SIZE);
|
|
32
|
+
config.set_initial_max_data(10_000_000);
|
|
33
|
+
config.set_initial_max_stream_data_bidi_local(1_000_000);
|
|
34
|
+
config.set_initial_max_stream_data_bidi_remote(1_000_000);
|
|
35
|
+
config.set_initial_max_stream_data_uni(1_000_000);
|
|
36
|
+
config.set_initial_max_streams_bidi(100);
|
|
37
|
+
config.set_initial_max_streams_uni(100);
|
|
38
|
+
config.set_disable_active_migration(true);
|
|
39
|
+
|
|
40
|
+
Ok(QuicConfig { inner: config })
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
fn set_verify_peer(&mut self, verify: bool) {
|
|
44
|
+
self.inner.verify_peer(verify);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
fn set_max_idle_timeout(&mut self, timeout_ms: u64) {
|
|
48
|
+
self.inner.set_max_idle_timeout(timeout_ms);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/// An HTTP/3 header (name, value pair).
|
|
53
|
+
#[pyclass(frozen)]
|
|
54
|
+
#[derive(Clone)]
|
|
55
|
+
struct H3Header {
|
|
56
|
+
#[pyo3(get)]
|
|
57
|
+
name: Vec<u8>,
|
|
58
|
+
#[pyo3(get)]
|
|
59
|
+
value: Vec<u8>,
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/// Events returned by H3Connection.poll().
|
|
63
|
+
#[pyclass(frozen)]
|
|
64
|
+
struct H3Event {
|
|
65
|
+
#[pyo3(get)]
|
|
66
|
+
event_type: String,
|
|
67
|
+
#[pyo3(get)]
|
|
68
|
+
stream_id: u64,
|
|
69
|
+
#[pyo3(get)]
|
|
70
|
+
headers: Option<Py<PyList>>,
|
|
71
|
+
#[pyo3(get)]
|
|
72
|
+
data: Option<Py<PyBytes>>,
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/// A QUIC + HTTP/3 client connection.
|
|
76
|
+
///
|
|
77
|
+
/// Wraps quiche::Connection + quiche::h3::Connection.
|
|
78
|
+
/// Sans-I/O: call feed_datagram() with received UDP packets,
|
|
79
|
+
/// and take_datagrams() to get outgoing UDP packets.
|
|
80
|
+
#[pyclass]
|
|
81
|
+
struct H3Connection {
|
|
82
|
+
quic: Option<quiche::Connection>,
|
|
83
|
+
h3: Option<quiche::h3::Connection>,
|
|
84
|
+
h3_config: quiche::h3::Config,
|
|
85
|
+
established: bool,
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
#[pymethods]
|
|
89
|
+
impl H3Connection {
|
|
90
|
+
/// Create a new HTTP/3 client connection.
|
|
91
|
+
#[new]
|
|
92
|
+
fn new(server_name: &str, config: &mut QuicConfig) -> PyResult<Self> {
|
|
93
|
+
let mut scid = [0u8; quiche::MAX_CONN_ID_LEN];
|
|
94
|
+
use ring::rand::SecureRandom;
|
|
95
|
+
ring::rand::SystemRandom::new()
|
|
96
|
+
.fill(&mut scid)
|
|
97
|
+
.map_err(|_| PyValueError::new_err("failed to generate connection ID"))?;
|
|
98
|
+
let scid = quiche::ConnectionId::from_ref(&scid);
|
|
99
|
+
|
|
100
|
+
// Use dummy addresses - actual UDP I/O is handled by Python.
|
|
101
|
+
let local: SocketAddr = "0.0.0.0:0".parse().unwrap();
|
|
102
|
+
let peer: SocketAddr = "0.0.0.0:443".parse().unwrap();
|
|
103
|
+
|
|
104
|
+
let conn = quiche::connect(Some(server_name), &scid, local, peer, &mut config.inner)
|
|
105
|
+
.map_err(|e| PyConnectionError::new_err(format!("QUIC connect failed: {e}")))?;
|
|
106
|
+
|
|
107
|
+
let h3_config = quiche::h3::Config::new().map_err(|e| PyValueError::new_err(format!("{e}")))?;
|
|
108
|
+
|
|
109
|
+
Ok(H3Connection {
|
|
110
|
+
quic: Some(conn),
|
|
111
|
+
h3: None,
|
|
112
|
+
h3_config,
|
|
113
|
+
established: false,
|
|
114
|
+
})
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/// Get the initial QUIC handshake data to send to the server.
|
|
118
|
+
fn initial_data<'py>(&mut self, py: Python<'py>) -> PyResult<Bound<'py, PyBytes>> {
|
|
119
|
+
let conn = self.quic.as_mut().ok_or_else(|| PyValueError::new_err("connection closed"))?;
|
|
120
|
+
let mut out = vec![0u8; MAX_DATAGRAM_SIZE];
|
|
121
|
+
let (write, _send_info) = conn
|
|
122
|
+
.send(&mut out)
|
|
123
|
+
.map_err(|e| PyConnectionError::new_err(format!("QUIC send failed: {e}")))?;
|
|
124
|
+
Ok(PyBytes::new(py, &out[..write]))
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/// Feed a received UDP datagram into the QUIC connection.
|
|
128
|
+
fn feed_datagram(&mut self, data: &[u8]) -> PyResult<()> {
|
|
129
|
+
let conn = self.quic.as_mut().ok_or_else(|| PyValueError::new_err("connection closed"))?;
|
|
130
|
+
|
|
131
|
+
let recv_info = quiche::RecvInfo {
|
|
132
|
+
from: "0.0.0.0:443".parse().unwrap(),
|
|
133
|
+
to: "0.0.0.0:0".parse().unwrap(),
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
conn.recv(&mut data.to_vec(), recv_info)
|
|
137
|
+
.map_err(|e| PyConnectionError::new_err(format!("QUIC recv failed: {e}")))?;
|
|
138
|
+
|
|
139
|
+
// Check if QUIC handshake just completed.
|
|
140
|
+
if conn.is_established() && !self.established {
|
|
141
|
+
self.established = true;
|
|
142
|
+
let h3_conn = quiche::h3::Connection::with_transport(conn, &self.h3_config)
|
|
143
|
+
.map_err(|e| PyConnectionError::new_err(format!("H3 connection failed: {e}")))?;
|
|
144
|
+
self.h3 = Some(h3_conn);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
Ok(())
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/// Get outgoing QUIC datagrams to send via UDP.
|
|
151
|
+
fn take_datagrams<'py>(&mut self, py: Python<'py>) -> PyResult<Bound<'py, PyList>> {
|
|
152
|
+
let conn = self.quic.as_mut().ok_or_else(|| PyValueError::new_err("connection closed"))?;
|
|
153
|
+
let list = PyList::empty(py);
|
|
154
|
+
let mut out = vec![0u8; MAX_DATAGRAM_SIZE];
|
|
155
|
+
|
|
156
|
+
loop {
|
|
157
|
+
match conn.send(&mut out) {
|
|
158
|
+
Ok((write, _send_info)) => {
|
|
159
|
+
list.append(PyBytes::new(py, &out[..write]))?;
|
|
160
|
+
}
|
|
161
|
+
Err(quiche::Error::Done) => break,
|
|
162
|
+
Err(e) => return Err(PyConnectionError::new_err(format!("QUIC send failed: {e}"))),
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
Ok(list)
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/// Send an HTTP/3 request.
|
|
170
|
+
/// Returns the stream ID.
|
|
171
|
+
fn send_request(&mut self, headers: Vec<(Vec<u8>, Vec<u8>)>, fin: bool) -> PyResult<u64> {
|
|
172
|
+
let conn = self.quic.as_mut().ok_or_else(|| PyValueError::new_err("connection closed"))?;
|
|
173
|
+
let h3 = self.h3.as_mut().ok_or_else(|| PyValueError::new_err("H3 not established"))?;
|
|
174
|
+
|
|
175
|
+
let h3_headers: Vec<quiche::h3::Header> = headers
|
|
176
|
+
.iter()
|
|
177
|
+
.map(|(n, v)| quiche::h3::Header::new(n, v))
|
|
178
|
+
.collect();
|
|
179
|
+
|
|
180
|
+
let stream_id = h3
|
|
181
|
+
.send_request(conn, &h3_headers, fin)
|
|
182
|
+
.map_err(|e| PyConnectionError::new_err(format!("H3 send_request failed: {e}")))?;
|
|
183
|
+
|
|
184
|
+
Ok(stream_id)
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/// Send HTTP/3 request body data on a stream.
|
|
188
|
+
fn send_body(&mut self, stream_id: u64, data: &[u8], fin: bool) -> PyResult<usize> {
|
|
189
|
+
let conn = self.quic.as_mut().ok_or_else(|| PyValueError::new_err("connection closed"))?;
|
|
190
|
+
let h3 = self.h3.as_mut().ok_or_else(|| PyValueError::new_err("H3 not established"))?;
|
|
191
|
+
|
|
192
|
+
let written = h3
|
|
193
|
+
.send_body(conn, stream_id, data, fin)
|
|
194
|
+
.map_err(|e| PyConnectionError::new_err(format!("H3 send_body failed: {e}")))?;
|
|
195
|
+
|
|
196
|
+
Ok(written)
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/// Poll for HTTP/3 events.
|
|
200
|
+
/// Returns a list of H3Event objects, or empty list if no events.
|
|
201
|
+
fn poll<'py>(&mut self, py: Python<'py>) -> PyResult<Bound<'py, PyList>> {
|
|
202
|
+
let conn = self.quic.as_mut().ok_or_else(|| PyValueError::new_err("connection closed"))?;
|
|
203
|
+
let h3 = match self.h3.as_mut() {
|
|
204
|
+
Some(h3) => h3,
|
|
205
|
+
None => return Ok(PyList::empty(py)),
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
let events = PyList::empty(py);
|
|
209
|
+
|
|
210
|
+
loop {
|
|
211
|
+
match h3.poll(conn) {
|
|
212
|
+
Ok((stream_id, quiche::h3::Event::Headers { list, .. })) => {
|
|
213
|
+
let py_headers = PyList::empty(py);
|
|
214
|
+
for header in &list {
|
|
215
|
+
let h = H3Header {
|
|
216
|
+
name: header.name().to_vec(),
|
|
217
|
+
value: header.value().to_vec(),
|
|
218
|
+
};
|
|
219
|
+
py_headers.append(h.into_pyobject(py)?)?;
|
|
220
|
+
}
|
|
221
|
+
let event = H3Event {
|
|
222
|
+
event_type: "headers".to_string(),
|
|
223
|
+
stream_id,
|
|
224
|
+
headers: Some(py_headers.into()),
|
|
225
|
+
data: None,
|
|
226
|
+
};
|
|
227
|
+
events.append(event.into_pyobject(py)?)?;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
Ok((stream_id, quiche::h3::Event::Data)) => {
|
|
231
|
+
let mut buf = vec![0u8; 65536];
|
|
232
|
+
let mut all_data = Vec::new();
|
|
233
|
+
while let Ok(read) = h3.recv_body(conn, stream_id, &mut buf) {
|
|
234
|
+
all_data.extend_from_slice(&buf[..read]);
|
|
235
|
+
}
|
|
236
|
+
let event = H3Event {
|
|
237
|
+
event_type: "data".to_string(),
|
|
238
|
+
stream_id,
|
|
239
|
+
headers: None,
|
|
240
|
+
data: Some(PyBytes::new(py, &all_data).into()),
|
|
241
|
+
};
|
|
242
|
+
events.append(event.into_pyobject(py)?)?;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
Ok((stream_id, quiche::h3::Event::Finished)) => {
|
|
246
|
+
let event = H3Event {
|
|
247
|
+
event_type: "finished".to_string(),
|
|
248
|
+
stream_id,
|
|
249
|
+
headers: None,
|
|
250
|
+
data: None,
|
|
251
|
+
};
|
|
252
|
+
events.append(event.into_pyobject(py)?)?;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
Ok((stream_id, quiche::h3::Event::Reset(error_code))) => {
|
|
256
|
+
let event = H3Event {
|
|
257
|
+
event_type: "reset".to_string(),
|
|
258
|
+
stream_id,
|
|
259
|
+
headers: None,
|
|
260
|
+
data: Some(PyBytes::new(py, &error_code.to_be_bytes()).into()),
|
|
261
|
+
};
|
|
262
|
+
events.append(event.into_pyobject(py)?)?;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
Ok((_stream_id, quiche::h3::Event::PriorityUpdate)) => {
|
|
266
|
+
// Ignore priority updates.
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
Ok((_stream_id, quiche::h3::Event::GoAway)) => {
|
|
270
|
+
let event = H3Event {
|
|
271
|
+
event_type: "goaway".to_string(),
|
|
272
|
+
stream_id: 0,
|
|
273
|
+
headers: None,
|
|
274
|
+
data: None,
|
|
275
|
+
};
|
|
276
|
+
events.append(event.into_pyobject(py)?)?;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
Err(quiche::h3::Error::Done) => break,
|
|
280
|
+
|
|
281
|
+
Err(e) => {
|
|
282
|
+
return Err(PyConnectionError::new_err(format!("H3 poll error: {e}")));
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
Ok(events)
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/// Check if the QUIC connection is established.
|
|
291
|
+
fn is_established(&self) -> bool {
|
|
292
|
+
self.established
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/// Check if the connection is closed.
|
|
296
|
+
fn is_closed(&self) -> bool {
|
|
297
|
+
match &self.quic {
|
|
298
|
+
Some(conn) => conn.is_closed(),
|
|
299
|
+
None => true,
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/// Get the connection timeout in milliseconds.
|
|
304
|
+
/// Returns None if no timeout is set.
|
|
305
|
+
fn timeout_ms(&self) -> Option<u64> {
|
|
306
|
+
self.quic
|
|
307
|
+
.as_ref()
|
|
308
|
+
.and_then(|conn| conn.timeout())
|
|
309
|
+
.map(|d| d.as_millis() as u64)
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/// Notify the connection that the timeout has expired.
|
|
313
|
+
fn on_timeout(&mut self) {
|
|
314
|
+
if let Some(conn) = self.quic.as_mut() {
|
|
315
|
+
conn.on_timeout();
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/// Close the connection.
|
|
320
|
+
fn close(&mut self, app: bool, error_code: u64, reason: &[u8]) -> PyResult<()> {
|
|
321
|
+
if let Some(conn) = self.quic.as_mut() {
|
|
322
|
+
conn.close(app, error_code, reason)
|
|
323
|
+
.map_err(|e| PyConnectionError::new_err(format!("close failed: {e}")))?;
|
|
324
|
+
}
|
|
325
|
+
Ok(())
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
#[pymodule]
|
|
330
|
+
fn _native(m: &Bound<'_, PyModule>) -> PyResult<()> {
|
|
331
|
+
m.add_class::<QuicConfig>()?;
|
|
332
|
+
m.add_class::<H3Connection>()?;
|
|
333
|
+
m.add_class::<H3Header>()?;
|
|
334
|
+
m.add_class::<H3Event>()?;
|
|
335
|
+
Ok(())
|
|
336
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from httpdex_h3._native import H3Connection, QuicConfig
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def test_config_creation() -> None:
|
|
7
|
+
config = QuicConfig()
|
|
8
|
+
config.set_verify_peer(False)
|
|
9
|
+
config.set_max_idle_timeout(10_000)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def test_connection_creation() -> None:
|
|
13
|
+
config = QuicConfig()
|
|
14
|
+
config.set_verify_peer(False)
|
|
15
|
+
conn = H3Connection("example.com", config)
|
|
16
|
+
assert not conn.is_established()
|
|
17
|
+
assert not conn.is_closed()
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def test_initial_data() -> None:
|
|
21
|
+
config = QuicConfig()
|
|
22
|
+
config.set_verify_peer(False)
|
|
23
|
+
conn = H3Connection("example.com", config)
|
|
24
|
+
data = conn.initial_data()
|
|
25
|
+
# Should produce a QUIC Initial packet.
|
|
26
|
+
assert len(data) > 0
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def test_timeout() -> None:
|
|
30
|
+
config = QuicConfig()
|
|
31
|
+
config.set_verify_peer(False)
|
|
32
|
+
conn = H3Connection("example.com", config)
|
|
33
|
+
_ = conn.initial_data()
|
|
34
|
+
# After sending initial data, there should be a timeout.
|
|
35
|
+
timeout = conn.timeout_ms()
|
|
36
|
+
assert timeout is not None
|
|
37
|
+
assert timeout > 0
|
|
File without changes
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["maturin>=1.7,<2.0"]
|
|
3
|
+
build-backend = "maturin"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "httpdex-h3"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "HTTP/3 client via QUIC (quiche) with PyO3 bindings."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">= 3.10"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
authors = [{ name = "Marcelo Trylesinski" }]
|
|
13
|
+
|
|
14
|
+
[dependency-groups]
|
|
15
|
+
dev = [
|
|
16
|
+
"pytest>=8.0",
|
|
17
|
+
"pytest-cov>=6.0",
|
|
18
|
+
"coverage[toml]>=7.0",
|
|
19
|
+
"ruff>=0.11",
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
[tool.maturin]
|
|
23
|
+
features = ["pyo3/extension-module"]
|
|
24
|
+
module-name = "httpdex_h3._native"
|
|
25
|
+
manifest-path = "crates/quic/Cargo.toml"
|
|
26
|
+
|
|
27
|
+
[tool.pytest.ini_options]
|
|
28
|
+
strict_config = true
|
|
29
|
+
strict_markers = true
|
|
30
|
+
filterwarnings = ["error"]
|
|
31
|
+
testpaths = ["httpdex_h3"]
|
|
32
|
+
addopts = "--cov --cov-report=term-missing"
|
|
33
|
+
|
|
34
|
+
[tool.coverage.run]
|
|
35
|
+
source_pkgs = ["httpdex_h3"]
|
|
36
|
+
branch = true
|
|
37
|
+
|
|
38
|
+
[tool.coverage.report]
|
|
39
|
+
fail_under = 100
|
|
40
|
+
exclude_lines = [
|
|
41
|
+
"pragma: no cover",
|
|
42
|
+
"if TYPE_CHECKING:",
|
|
43
|
+
"raise NotImplementedError",
|
|
44
|
+
"@overload",
|
|
45
|
+
]
|
|
46
|
+
omit = [
|
|
47
|
+
"httpdex_h3/*_test.py",
|
|
48
|
+
]
|
|
49
|
+
|
|
50
|
+
[tool.ruff]
|
|
51
|
+
line-length = 120
|
|
52
|
+
target-version = "py310"
|
|
53
|
+
|
|
54
|
+
[tool.ruff.lint]
|
|
55
|
+
select = ["E", "F", "I", "FA", "UP", "RUF100"]
|
|
56
|
+
|
|
57
|
+
[tool.ruff.lint.isort]
|
|
58
|
+
combine-as-imports = true
|