rwebtransport 0.2.3 → 0.2.5
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.
- package/Cargo.lock +153 -226
- package/Cargo.toml +5 -5
- package/README.md +4 -4
- package/crates/echo-server/src/bin/gen-test-cert.rs +1 -1
- package/crates/native/Cargo.toml +1 -1
- package/crates/native/src/config.rs +13 -1
- package/crates/native/src/driver.rs +249 -91
- package/crates/native/src/lib.rs +9 -10
- package/crates/native/src/parser_memory.rs +1 -0
- package/crates/native/src/server.rs +197 -182
- package/crates/native/src/session.rs +329 -177
- package/crates/native/src/test_support.rs +2 -2
- package/crates/wtcore/src/h3.rs +166 -10
- package/dist/index.js +92 -45
- package/dist/index.js.map +2 -2
- package/dist/index.mjs +92 -45
- package/dist/index.mjs.map +2 -2
- package/dist/native.d.ts +9 -4
- package/package.json +14 -11
- package/prebuilds/darwin-arm64/rwebtransport.node +0 -0
- package/prebuilds/linux-arm64/rwebtransport.node +0 -0
- package/prebuilds/linux-x64/rwebtransport.node +0 -0
- package/prebuilds/win32-x64/rwebtransport.node +0 -0
- package/scripts/build-linux-prebuilt.sh +46 -0
- package/scripts/build.js +10 -3
- package/vendor/quiche/AGENTS.md +10 -0
- package/vendor/quiche/Cargo.lock +239 -248
- package/vendor/quiche/Cargo.toml +23 -10
- package/vendor/quiche/examples/Makefile +4 -4
- package/vendor/quiche/examples/client.rs +10 -28
- package/vendor/quiche/examples/http3-client.rs +20 -34
- package/vendor/quiche/examples/http3-server.rs +47 -78
- package/vendor/quiche/examples/server.rs +19 -49
- package/vendor/quiche/include/quiche.h +35 -4
- package/vendor/quiche/src/build.rs +17 -0
- package/vendor/quiche/src/cid.rs +129 -61
- package/vendor/quiche/src/crypto/boringssl.rs +98 -86
- package/vendor/quiche/src/crypto/mod.rs +64 -77
- package/vendor/quiche/src/dgram.rs +2 -3
- package/vendor/quiche/src/error.rs +22 -20
- package/vendor/quiche/src/ffi.rs +558 -280
- package/vendor/quiche/src/flowcontrol.rs +0 -7
- package/vendor/quiche/src/frame.rs +134 -135
- package/vendor/quiche/src/h3/ffi.rs +73 -60
- package/vendor/quiche/src/h3/frame.rs +70 -90
- package/vendor/quiche/src/h3/mod.rs +1024 -593
- package/vendor/quiche/src/h3/qpack/decoder.rs +248 -34
- package/vendor/quiche/src/h3/qpack/dynamic_table.rs +859 -0
- package/vendor/quiche/src/h3/qpack/encoder.rs +14 -17
- package/vendor/quiche/src/h3/qpack/mod.rs +48 -0
- package/vendor/quiche/src/h3/qpack/static_table.rs +86 -73
- package/vendor/quiche/src/h3/stream.rs +1009 -194
- package/vendor/quiche/src/lib.rs +1346 -1195
- package/vendor/quiche/src/minmax.rs +2 -6
- package/vendor/quiche/src/packet.rs +420 -552
- package/vendor/quiche/src/path.rs +202 -72
- package/vendor/quiche/src/pmtud.rs +18 -16
- package/vendor/quiche/src/ranges.rs +184 -82
- package/vendor/quiche/src/recovery/AGENTS.md +5 -2
- package/vendor/quiche/src/recovery/bandwidth.rs +59 -40
- package/vendor/quiche/src/recovery/bytes_in_flight.rs +2 -2
- package/vendor/quiche/src/recovery/congestion/cubic.rs +38 -47
- package/vendor/quiche/src/recovery/congestion/delivery_rate.rs +54 -60
- package/vendor/quiche/src/recovery/congestion/hystart.rs +6 -10
- package/vendor/quiche/src/recovery/congestion/mod.rs +110 -42
- package/vendor/quiche/src/recovery/congestion/prr.rs +4 -1
- package/vendor/quiche/src/recovery/congestion/recovery.rs +91 -95
- package/vendor/quiche/src/recovery/congestion/reno.rs +17 -12
- package/vendor/quiche/src/recovery/congestion/test_sender.rs +8 -27
- package/vendor/quiche/src/recovery/gcongestion/bbr/bandwidth_sampler.rs +159 -247
- package/vendor/quiche/src/recovery/gcongestion/bbr/windowed_filter.rs +9 -14
- package/vendor/quiche/src/recovery/gcongestion/bbr2/drain.rs +18 -15
- package/vendor/quiche/src/recovery/gcongestion/bbr2/mode.rs +43 -28
- package/vendor/quiche/src/recovery/gcongestion/bbr2/network_model.rs +349 -76
- package/vendor/quiche/src/recovery/gcongestion/bbr2/probe_bw.rs +147 -195
- package/vendor/quiche/src/recovery/gcongestion/bbr2/probe_rtt.rs +29 -27
- package/vendor/quiche/src/recovery/gcongestion/bbr2/rtt_jump_detector/global_min.rs +180 -0
- package/vendor/quiche/src/recovery/gcongestion/bbr2/rtt_jump_detector/global_min_tests.rs +221 -0
- package/vendor/quiche/src/recovery/gcongestion/bbr2/rtt_jump_detector/hmm.rs +395 -0
- package/vendor/quiche/src/recovery/gcongestion/bbr2/rtt_jump_detector/hmm_tests.rs +473 -0
- package/vendor/quiche/src/recovery/gcongestion/bbr2/rtt_jump_detector/mod.rs +175 -0
- package/vendor/quiche/src/recovery/gcongestion/bbr2/startup.rs +33 -26
- package/vendor/quiche/src/recovery/gcongestion/bbr2.rs +107 -60
- package/vendor/quiche/src/recovery/gcongestion/mod.rs +64 -11
- package/vendor/quiche/src/recovery/gcongestion/pacer.rs +34 -25
- package/vendor/quiche/src/recovery/gcongestion/recovery.rs +81 -86
- package/vendor/quiche/src/recovery/mod.rs +414 -173
- package/vendor/quiche/src/recovery/rtt.rs +8 -5
- package/vendor/quiche/src/stream/mod.rs +864 -133
- package/vendor/quiche/src/stream/recv_buf.rs +471 -172
- package/vendor/quiche/src/stream/send_buf.rs +338 -81
- package/vendor/quiche/src/test_utils.rs +78 -64
- package/vendor/quiche/src/tests.rs +2559 -1335
- package/vendor/quiche/src/tls/boringssl.rs +60 -63
- package/vendor/quiche/src/tls/mod.rs +146 -193
- package/vendor/quiche/src/transport_params.rs +87 -103
|
@@ -47,7 +47,7 @@ pub const SETTINGS_H3_DATAGRAM_00: u64 = 0x276;
|
|
|
47
47
|
pub const SETTINGS_H3_DATAGRAM: u64 = 0x33;
|
|
48
48
|
|
|
49
49
|
// Permit between 16 maximally-encoded and 128 minimally-encoded SETTINGS.
|
|
50
|
-
const MAX_SETTINGS_PAYLOAD_SIZE: usize = 256;
|
|
50
|
+
pub(crate) const MAX_SETTINGS_PAYLOAD_SIZE: usize = 256;
|
|
51
51
|
|
|
52
52
|
#[derive(Clone, PartialEq, Eq)]
|
|
53
53
|
pub enum Frame {
|
|
@@ -104,9 +104,7 @@ pub enum Frame {
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
impl Frame {
|
|
107
|
-
pub fn from_bytes(
|
|
108
|
-
frame_type: u64, payload_length: u64, bytes: &[u8],
|
|
109
|
-
) -> Result<Frame> {
|
|
107
|
+
pub fn from_bytes(frame_type: u64, payload_length: u64, bytes: &[u8]) -> Result<Frame> {
|
|
110
108
|
let mut b = octets::Octets::with_slice(bytes);
|
|
111
109
|
|
|
112
110
|
// TODO: handling of 0-length frames
|
|
@@ -123,11 +121,9 @@ impl Frame {
|
|
|
123
121
|
push_id: b.get_varint()?,
|
|
124
122
|
},
|
|
125
123
|
|
|
126
|
-
SETTINGS_FRAME_TYPE_ID =>
|
|
127
|
-
parse_settings_frame(&mut b, payload_length as usize)?,
|
|
124
|
+
SETTINGS_FRAME_TYPE_ID => parse_settings_frame(&mut b, payload_length as usize)?,
|
|
128
125
|
|
|
129
|
-
PUSH_PROMISE_FRAME_TYPE_ID =>
|
|
130
|
-
parse_push_promise(payload_length, &mut b)?,
|
|
126
|
+
PUSH_PROMISE_FRAME_TYPE_ID => parse_push_promise(payload_length, &mut b)?,
|
|
131
127
|
|
|
132
128
|
GOAWAY_FRAME_TYPE_ID => Frame::GoAway {
|
|
133
129
|
id: b.get_varint()?,
|
|
@@ -137,9 +133,9 @@ impl Frame {
|
|
|
137
133
|
push_id: b.get_varint()?,
|
|
138
134
|
},
|
|
139
135
|
|
|
140
|
-
PRIORITY_UPDATE_FRAME_REQUEST_TYPE_ID |
|
|
141
|
-
|
|
142
|
-
|
|
136
|
+
PRIORITY_UPDATE_FRAME_REQUEST_TYPE_ID | PRIORITY_UPDATE_FRAME_PUSH_TYPE_ID => {
|
|
137
|
+
parse_priority_update(frame_type, payload_length, &mut b)?
|
|
138
|
+
}
|
|
143
139
|
|
|
144
140
|
_ => Frame::Unknown {
|
|
145
141
|
raw_type: frame_type,
|
|
@@ -159,21 +155,21 @@ impl Frame {
|
|
|
159
155
|
b.put_varint(payload.len() as u64)?;
|
|
160
156
|
|
|
161
157
|
b.put_bytes(payload.as_ref())?;
|
|
162
|
-
}
|
|
158
|
+
}
|
|
163
159
|
|
|
164
160
|
Frame::Headers { header_block } => {
|
|
165
161
|
b.put_varint(HEADERS_FRAME_TYPE_ID)?;
|
|
166
162
|
b.put_varint(header_block.len() as u64)?;
|
|
167
163
|
|
|
168
164
|
b.put_bytes(header_block.as_ref())?;
|
|
169
|
-
}
|
|
165
|
+
}
|
|
170
166
|
|
|
171
167
|
Frame::CancelPush { push_id } => {
|
|
172
168
|
b.put_varint(CANCEL_PUSH_FRAME_TYPE_ID)?;
|
|
173
169
|
b.put_varint(octets::varint_len(*push_id) as u64)?;
|
|
174
170
|
|
|
175
171
|
b.put_varint(*push_id)?;
|
|
176
|
-
}
|
|
172
|
+
}
|
|
177
173
|
|
|
178
174
|
Frame::Settings {
|
|
179
175
|
max_field_section_size,
|
|
@@ -267,7 +263,7 @@ impl Frame {
|
|
|
267
263
|
b.put_varint(val.1)?;
|
|
268
264
|
}
|
|
269
265
|
}
|
|
270
|
-
}
|
|
266
|
+
}
|
|
271
267
|
|
|
272
268
|
Frame::PushPromise {
|
|
273
269
|
push_id,
|
|
@@ -279,56 +275,54 @@ impl Frame {
|
|
|
279
275
|
|
|
280
276
|
b.put_varint(*push_id)?;
|
|
281
277
|
b.put_bytes(header_block.as_ref())?;
|
|
282
|
-
}
|
|
278
|
+
}
|
|
283
279
|
|
|
284
280
|
Frame::GoAway { id } => {
|
|
285
281
|
b.put_varint(GOAWAY_FRAME_TYPE_ID)?;
|
|
286
282
|
b.put_varint(octets::varint_len(*id) as u64)?;
|
|
287
283
|
|
|
288
284
|
b.put_varint(*id)?;
|
|
289
|
-
}
|
|
285
|
+
}
|
|
290
286
|
|
|
291
287
|
Frame::MaxPushId { push_id } => {
|
|
292
288
|
b.put_varint(MAX_PUSH_FRAME_TYPE_ID)?;
|
|
293
289
|
b.put_varint(octets::varint_len(*push_id) as u64)?;
|
|
294
290
|
|
|
295
291
|
b.put_varint(*push_id)?;
|
|
296
|
-
}
|
|
292
|
+
}
|
|
297
293
|
|
|
298
294
|
Frame::PriorityUpdateRequest {
|
|
299
295
|
prioritized_element_id,
|
|
300
296
|
priority_field_value,
|
|
301
297
|
} => {
|
|
302
|
-
let len = octets::varint_len(*prioritized_element_id) +
|
|
303
|
-
priority_field_value.len();
|
|
298
|
+
let len = octets::varint_len(*prioritized_element_id) + priority_field_value.len();
|
|
304
299
|
|
|
305
300
|
b.put_varint(PRIORITY_UPDATE_FRAME_REQUEST_TYPE_ID)?;
|
|
306
301
|
b.put_varint(len as u64)?;
|
|
307
302
|
|
|
308
303
|
b.put_varint(*prioritized_element_id)?;
|
|
309
304
|
b.put_bytes(priority_field_value)?;
|
|
310
|
-
}
|
|
305
|
+
}
|
|
311
306
|
|
|
312
307
|
Frame::PriorityUpdatePush {
|
|
313
308
|
prioritized_element_id,
|
|
314
309
|
priority_field_value,
|
|
315
310
|
} => {
|
|
316
|
-
let len = octets::varint_len(*prioritized_element_id) +
|
|
317
|
-
priority_field_value.len();
|
|
311
|
+
let len = octets::varint_len(*prioritized_element_id) + priority_field_value.len();
|
|
318
312
|
|
|
319
313
|
b.put_varint(PRIORITY_UPDATE_FRAME_PUSH_TYPE_ID)?;
|
|
320
314
|
b.put_varint(len as u64)?;
|
|
321
315
|
|
|
322
316
|
b.put_varint(*prioritized_element_id)?;
|
|
323
317
|
b.put_bytes(priority_field_value)?;
|
|
324
|
-
}
|
|
318
|
+
}
|
|
325
319
|
|
|
326
320
|
Frame::Unknown { raw_type, payload } => {
|
|
327
321
|
b.put_varint(*raw_type)?;
|
|
328
322
|
b.put_varint(payload.len() as u64)?;
|
|
329
323
|
|
|
330
324
|
b.put_bytes(payload.as_ref())?;
|
|
331
|
-
}
|
|
325
|
+
}
|
|
332
326
|
}
|
|
333
327
|
|
|
334
328
|
Ok(before - b.cap())
|
|
@@ -392,9 +386,7 @@ impl Frame {
|
|
|
392
386
|
|
|
393
387
|
if let Some(v) = connect_protocol_enabled {
|
|
394
388
|
settings.push(qlog::events::http3::Setting {
|
|
395
|
-
name: Some(
|
|
396
|
-
"SETTINGS_ENABLE_CONNECT_PROTOCOL".to_string(),
|
|
397
|
-
),
|
|
389
|
+
name: Some("SETTINGS_ENABLE_CONNECT_PROTOCOL".to_string()),
|
|
398
390
|
name_bytes: None,
|
|
399
391
|
value: *v,
|
|
400
392
|
});
|
|
@@ -430,7 +422,7 @@ impl Frame {
|
|
|
430
422
|
settings,
|
|
431
423
|
raw: None,
|
|
432
424
|
}
|
|
433
|
-
}
|
|
425
|
+
}
|
|
434
426
|
|
|
435
427
|
// Qlog expects the `headers` to be represented as an array of
|
|
436
428
|
// name:value pairs. At this stage, we only have the qpack block, so
|
|
@@ -454,10 +446,7 @@ impl Frame {
|
|
|
454
446
|
} => Http3Frame::PriorityUpdate {
|
|
455
447
|
stream_id: Some(*prioritized_element_id),
|
|
456
448
|
push_id: None,
|
|
457
|
-
priority_field_value: String::from_utf8_lossy(
|
|
458
|
-
priority_field_value,
|
|
459
|
-
)
|
|
460
|
-
.into_owned(),
|
|
449
|
+
priority_field_value: String::from_utf8_lossy(priority_field_value).into_owned(),
|
|
461
450
|
raw: None,
|
|
462
451
|
},
|
|
463
452
|
|
|
@@ -467,10 +456,7 @@ impl Frame {
|
|
|
467
456
|
} => Http3Frame::PriorityUpdate {
|
|
468
457
|
stream_id: None,
|
|
469
458
|
push_id: Some(*prioritized_element_id),
|
|
470
|
-
priority_field_value: String::from_utf8_lossy(
|
|
471
|
-
priority_field_value,
|
|
472
|
-
)
|
|
473
|
-
.into_owned(),
|
|
459
|
+
priority_field_value: String::from_utf8_lossy(priority_field_value).into_owned(),
|
|
474
460
|
raw: None,
|
|
475
461
|
},
|
|
476
462
|
|
|
@@ -491,15 +477,15 @@ impl std::fmt::Debug for Frame {
|
|
|
491
477
|
match self {
|
|
492
478
|
Frame::Data { .. } => {
|
|
493
479
|
write!(f, "DATA")?;
|
|
494
|
-
}
|
|
480
|
+
}
|
|
495
481
|
|
|
496
482
|
Frame::Headers { .. } => {
|
|
497
483
|
write!(f, "HEADERS")?;
|
|
498
|
-
}
|
|
484
|
+
}
|
|
499
485
|
|
|
500
486
|
Frame::CancelPush { push_id } => {
|
|
501
487
|
write!(f, "CANCEL_PUSH push_id={push_id}")?;
|
|
502
|
-
}
|
|
488
|
+
}
|
|
503
489
|
|
|
504
490
|
Frame::Settings {
|
|
505
491
|
max_field_section_size,
|
|
@@ -510,7 +496,7 @@ impl std::fmt::Debug for Frame {
|
|
|
510
496
|
..
|
|
511
497
|
} => {
|
|
512
498
|
write!(f, "SETTINGS max_field_section={max_field_section_size:?}, qpack_max_table={qpack_max_table_capacity:?}, qpack_blocked={qpack_blocked_streams:?} raw={raw:?}, additional_settings={additional_settings:?}")?;
|
|
513
|
-
}
|
|
499
|
+
}
|
|
514
500
|
|
|
515
501
|
Frame::PushPromise {
|
|
516
502
|
push_id,
|
|
@@ -522,15 +508,15 @@ impl std::fmt::Debug for Frame {
|
|
|
522
508
|
push_id,
|
|
523
509
|
header_block.len()
|
|
524
510
|
)?;
|
|
525
|
-
}
|
|
511
|
+
}
|
|
526
512
|
|
|
527
513
|
Frame::GoAway { id } => {
|
|
528
514
|
write!(f, "GOAWAY id={id}")?;
|
|
529
|
-
}
|
|
515
|
+
}
|
|
530
516
|
|
|
531
517
|
Frame::MaxPushId { push_id } => {
|
|
532
518
|
write!(f, "MAX_PUSH_ID push_id={push_id}")?;
|
|
533
|
-
}
|
|
519
|
+
}
|
|
534
520
|
|
|
535
521
|
Frame::PriorityUpdateRequest {
|
|
536
522
|
prioritized_element_id,
|
|
@@ -542,7 +528,7 @@ impl std::fmt::Debug for Frame {
|
|
|
542
528
|
prioritized_element_id,
|
|
543
529
|
priority_field_value.len()
|
|
544
530
|
)?;
|
|
545
|
-
}
|
|
531
|
+
}
|
|
546
532
|
|
|
547
533
|
Frame::PriorityUpdatePush {
|
|
548
534
|
prioritized_element_id,
|
|
@@ -554,20 +540,18 @@ impl std::fmt::Debug for Frame {
|
|
|
554
540
|
prioritized_element_id,
|
|
555
541
|
priority_field_value.len()
|
|
556
542
|
)?;
|
|
557
|
-
}
|
|
543
|
+
}
|
|
558
544
|
|
|
559
545
|
Frame::Unknown { raw_type, .. } => {
|
|
560
546
|
write!(f, "UNKNOWN raw_type={raw_type}",)?;
|
|
561
|
-
}
|
|
547
|
+
}
|
|
562
548
|
}
|
|
563
549
|
|
|
564
550
|
Ok(())
|
|
565
551
|
}
|
|
566
552
|
}
|
|
567
553
|
|
|
568
|
-
fn parse_settings_frame(
|
|
569
|
-
b: &mut octets::Octets, settings_length: usize,
|
|
570
|
-
) -> Result<Frame> {
|
|
554
|
+
fn parse_settings_frame(b: &mut octets::Octets, settings_length: usize) -> Result<Frame> {
|
|
571
555
|
let mut max_field_section_size = None;
|
|
572
556
|
let mut qpack_max_table_capacity = None;
|
|
573
557
|
let mut qpack_blocked_streams = None;
|
|
@@ -592,15 +576,15 @@ fn parse_settings_frame(
|
|
|
592
576
|
match identifier {
|
|
593
577
|
SETTINGS_QPACK_MAX_TABLE_CAPACITY => {
|
|
594
578
|
qpack_max_table_capacity = Some(value);
|
|
595
|
-
}
|
|
579
|
+
}
|
|
596
580
|
|
|
597
581
|
SETTINGS_MAX_FIELD_SECTION_SIZE => {
|
|
598
582
|
max_field_section_size = Some(value);
|
|
599
|
-
}
|
|
583
|
+
}
|
|
600
584
|
|
|
601
585
|
SETTINGS_QPACK_BLOCKED_STREAMS => {
|
|
602
586
|
qpack_blocked_streams = Some(value);
|
|
603
|
-
}
|
|
587
|
+
}
|
|
604
588
|
|
|
605
589
|
SETTINGS_ENABLE_CONNECT_PROTOCOL => {
|
|
606
590
|
if value > 1 {
|
|
@@ -608,7 +592,7 @@ fn parse_settings_frame(
|
|
|
608
592
|
}
|
|
609
593
|
|
|
610
594
|
connect_protocol_enabled = Some(value);
|
|
611
|
-
}
|
|
595
|
+
}
|
|
612
596
|
|
|
613
597
|
SETTINGS_H3_DATAGRAM_00 | SETTINGS_H3_DATAGRAM => {
|
|
614
598
|
if value > 1 {
|
|
@@ -616,18 +600,16 @@ fn parse_settings_frame(
|
|
|
616
600
|
}
|
|
617
601
|
|
|
618
602
|
h3_datagram = Some(value);
|
|
619
|
-
}
|
|
603
|
+
}
|
|
620
604
|
|
|
621
605
|
// Reserved values overlap with HTTP/2 and MUST be rejected
|
|
622
|
-
0x0 | 0x2 | 0x3 | 0x4 | 0x5 =>
|
|
623
|
-
return Err(super::Error::SettingsError),
|
|
606
|
+
0x0 | 0x2 | 0x3 | 0x4 | 0x5 => return Err(super::Error::SettingsError),
|
|
624
607
|
|
|
625
608
|
// Unknown Settings parameters go into additional_settings.
|
|
626
609
|
_ => {
|
|
627
|
-
let s: &mut Vec<(u64, u64)> =
|
|
628
|
-
additional_settings.get_or_insert(vec![]);
|
|
610
|
+
let s: &mut Vec<(u64, u64)> = additional_settings.get_or_insert(vec![]);
|
|
629
611
|
s.push((identifier, value));
|
|
630
|
-
}
|
|
612
|
+
}
|
|
631
613
|
}
|
|
632
614
|
}
|
|
633
615
|
|
|
@@ -643,9 +625,7 @@ fn parse_settings_frame(
|
|
|
643
625
|
})
|
|
644
626
|
}
|
|
645
627
|
|
|
646
|
-
fn parse_push_promise(
|
|
647
|
-
payload_length: u64, b: &mut octets::Octets,
|
|
648
|
-
) -> Result<Frame> {
|
|
628
|
+
fn parse_push_promise(payload_length: u64, b: &mut octets::Octets) -> Result<Frame> {
|
|
649
629
|
let before = b.off();
|
|
650
630
|
let push_id = b.get_varint()?;
|
|
651
631
|
let header_block_length = payload_length - (b.off() - before) as u64;
|
|
@@ -658,20 +638,20 @@ fn parse_push_promise(
|
|
|
658
638
|
}
|
|
659
639
|
|
|
660
640
|
fn parse_priority_update(
|
|
661
|
-
frame_type: u64,
|
|
641
|
+
frame_type: u64,
|
|
642
|
+
payload_length: u64,
|
|
643
|
+
b: &mut octets::Octets,
|
|
662
644
|
) -> Result<Frame> {
|
|
663
645
|
let before = b.off();
|
|
664
646
|
let prioritized_element_id = b.get_varint()?;
|
|
665
647
|
let priority_field_value_length = payload_length - (b.off() - before) as u64;
|
|
666
|
-
let priority_field_value =
|
|
667
|
-
b.get_bytes(priority_field_value_length as usize)?.to_vec();
|
|
648
|
+
let priority_field_value = b.get_bytes(priority_field_value_length as usize)?.to_vec();
|
|
668
649
|
|
|
669
650
|
match frame_type {
|
|
670
|
-
PRIORITY_UPDATE_FRAME_REQUEST_TYPE_ID =>
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
}),
|
|
651
|
+
PRIORITY_UPDATE_FRAME_REQUEST_TYPE_ID => Ok(Frame::PriorityUpdateRequest {
|
|
652
|
+
prioritized_element_id,
|
|
653
|
+
priority_field_value,
|
|
654
|
+
}),
|
|
675
655
|
|
|
676
656
|
PRIORITY_UPDATE_FRAME_PUSH_TYPE_ID => Ok(Frame::PriorityUpdatePush {
|
|
677
657
|
prioritized_element_id,
|
|
@@ -990,8 +970,7 @@ mod tests {
|
|
|
990
970
|
fn settings_h3_dgram_only() {
|
|
991
971
|
let mut d = [42; 128];
|
|
992
972
|
|
|
993
|
-
let raw_settings =
|
|
994
|
-
vec![(SETTINGS_H3_DATAGRAM_00, 1), (SETTINGS_H3_DATAGRAM, 1)];
|
|
973
|
+
let raw_settings = vec![(SETTINGS_H3_DATAGRAM_00, 1), (SETTINGS_H3_DATAGRAM, 1)];
|
|
995
974
|
|
|
996
975
|
let frame = Frame::Settings {
|
|
997
976
|
max_field_section_size: None,
|
|
@@ -1103,9 +1082,8 @@ mod tests {
|
|
|
1103
1082
|
|
|
1104
1083
|
#[test]
|
|
1105
1084
|
fn settings_h2_prohibited() {
|
|
1106
|
-
//
|
|
1107
|
-
//
|
|
1108
|
-
// frame data buffer where d[frame_header_len] is the SETTING type field.
|
|
1085
|
+
// Test prohibited values manually because the quiche API cannot create
|
|
1086
|
+
// them. `d[frame_header_len]` contains the SETTINGS type.
|
|
1109
1087
|
let frame_payload_len = 2u64;
|
|
1110
1088
|
let frame_header_len = 2;
|
|
1111
1089
|
let mut d = [
|
|
@@ -1235,16 +1213,15 @@ mod tests {
|
|
|
1235
1213
|
let mut payload = vec![0x40u8, 0x25]; // non-minimal push_id = 37
|
|
1236
1214
|
payload.extend_from_slice(header_block);
|
|
1237
1215
|
let payload_length = payload.len() as u64;
|
|
1238
|
-
let frame = Frame::from_bytes(
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
});
|
|
1216
|
+
let frame = Frame::from_bytes(PUSH_PROMISE_FRAME_TYPE_ID, payload_length, &payload)
|
|
1217
|
+
.expect("non-minimal varint was parsed correctly");
|
|
1218
|
+
assert_eq!(
|
|
1219
|
+
frame,
|
|
1220
|
+
Frame::PushPromise {
|
|
1221
|
+
push_id: 37,
|
|
1222
|
+
header_block: header_block.to_vec(),
|
|
1223
|
+
}
|
|
1224
|
+
);
|
|
1248
1225
|
}
|
|
1249
1226
|
|
|
1250
1227
|
#[test]
|
|
@@ -1383,10 +1360,13 @@ mod tests {
|
|
|
1383
1360
|
)
|
|
1384
1361
|
.expect("non-minimal varint was parsed correctly");
|
|
1385
1362
|
|
|
1386
|
-
assert_eq!(
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1363
|
+
assert_eq!(
|
|
1364
|
+
frame,
|
|
1365
|
+
Frame::PriorityUpdateRequest {
|
|
1366
|
+
prioritized_element_id: 37,
|
|
1367
|
+
priority_field_value: priority_field.to_vec(),
|
|
1368
|
+
}
|
|
1369
|
+
);
|
|
1390
1370
|
}
|
|
1391
1371
|
|
|
1392
1372
|
#[test]
|