Commit e75b509
feat: expose 0-RTT detection at stream level (#323)
* feat: expose 0-RTT detection at stream level
* feat: move Is0rtt trait to quic layer and improve implementation
Address review feedback by refactoring 0-RTT detection:
- Move Is0rtt trait from h3::server to h3::quic module
All QUIC transport traits belong in the quic abstraction layer,
allowing libraries like hyper to use 0-RTT detection generically
across different QUIC implementations.
- Fix RecvStream::is_0rtt() to cache value at construction time
Previously used unwrap_or(false) which could incorrectly return
false for 0-RTT streams if poll API was misused. Now stores the
0-RTT flag in a dedicated field initialized in new().
- Implement Is0rtt trait for both BidiStream and RecvStream
Ensures consistent 0-RTT detection across all stream types.
- Simplify BidiStream implementation
Remove redundant public is_0rtt() method, keep only trait impl
that delegates to recv.is_0rtt().
- Keep RequestStream::is_0rtt() convenience method for ergonomic
stream-level access in server applications.
This maintains backward compatibility for users while fixing the
potential security issue where 0-RTT status could be lost.
Refs: PR #323
* fix: replace tabs with spaces in documentation comments
* fix doctest
* cleanup
---------
Co-authored-by: ruben <[email protected]>1 parent 0a19b03 commit e75b509
5 files changed
+80
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
338 | 338 | | |
339 | 339 | | |
340 | 340 | | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
341 | 350 | | |
342 | 351 | | |
343 | 352 | | |
344 | 353 | | |
345 | 354 | | |
346 | 355 | | |
| 356 | + | |
347 | 357 | | |
348 | 358 | | |
349 | 359 | | |
| |||
356 | 366 | | |
357 | 367 | | |
358 | 368 | | |
| 369 | + | |
359 | 370 | | |
360 | 371 | | |
361 | 372 | | |
362 | 373 | | |
| 374 | + | |
363 | 375 | | |
364 | 376 | | |
365 | 377 | | |
| |||
403 | 415 | | |
404 | 416 | | |
405 | 417 | | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
406 | 428 | | |
407 | 429 | | |
408 | 430 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
46 | 56 | | |
47 | 57 | | |
48 | 58 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
230 | 230 | | |
231 | 231 | | |
232 | 232 | | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
108 | 130 | | |
109 | 131 | | |
110 | 132 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
439 | 439 | | |
440 | 440 | | |
441 | 441 | | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
442 | 452 | | |
443 | 453 | | |
444 | 454 | | |
| |||
0 commit comments