wtransport
wtransport copied to clipboard
Wrong model for stream error codes
The stream error codes are modelled incorrectly.
Currently, wtransport
just passes the error code numeric value (in fact, the same VarInt
) through to the QUIC / HTTP3 layer.
However, this is not correct. WebTransport is supposed to apply the following conversion to the error codes:
fn webtransport_code_to_http_code(n: u32) -> wtransport::VarInt {
let first: u64 = 0x52e4a40fa8db;
let n: u64 = n.into();
let val: u64 = first + n + (n / 0x1e);
val.try_into().unwrap()
}
This is based on https://github.com/web-platform-tests/wpt/blob/master/webtransport/resources/webtransport-test-helpers.sub.js#L18 - which is based on https://ietf-wg-webtrans.github.io/draft-ietf-webtrans-http3/draft-ietf-webtrans-http3.html#section-4.3.