Repository navigation
fix(wasm): report None when no subprotocol was negotiated - #381
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reached
Next review available in: 14 minutes Limit details: You’ve used all 2 included reviews currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?Wait for the limit to reset, then comment An organization admin can change what happens after included review limits in Billing. How do review limits work?CodeRabbit enforces per-developer PR review limits within each organization. For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
`Session::protocol()` returned whatever the browser put on the
`protocol` property, and the browser reports `""` when no subprotocol
was selected. The trait contract says an unnegotiated protocol is
`None`, so callers matching the result against their own protocol table
saw `Some("")` and treated it as a peer choice rather than falling back
to negotiating over their own handshake.
Downstream adapters were already compensating with a
`.filter(|p| !p.is_empty())` on their side. Normalizing at the capture
site instead means the inherent getter and both trait impls agree
without each having to know about the browser's sentinel, and lets
those adapters be deleted rather than ported.
Covered by a harness case: `connect` there offers no subprotocols, so
the browser negotiates none. It fails with `Some("")` before this
change and passes with `None` after.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
b57b5d9 to
382918d
Compare
What
web_transport_wasm::Session::protocol()returnedSome("")when no subprotocol was negotiated. It now returnsNone.Why
The browser initializes
WebTransport.protocolto""when the server selects no subprotocol — the same sentinelWebSocketuses. We passed that straight through, butweb_transport_trait::Session::protocoldocumentsNoneas the "nothing was negotiated" answer, so the wasm backend was out of conformance with the trait it implements.The practical cost lands on callers: a caller matching the result against its own protocol table sees
Some("")and reads it as a peer choice, instead of falling back to negotiating a version over its own handshake.This was already known downstream. Both moq adapters (
rs/moq-wasm/src/transport.rs,rs/moq-ffi/src/transport.rs) carry a.filter(|p| !p.is_empty())with a comment explaining the browser's sentinel. Those adapters exist to bridge toweb-transport-traitand are slated for deletion now that this crate implements it natively (#369) — so the compensation has to move here or it gets deleted along with them.Normalizing at the capture site in
Session::newrather than in the getter keeps the inherent getter and both trait impls agreeing without each needing to know about"".Testing
Added a harness case.
connectin the harness offers no subprotocols, so the browser negotiates none — exactly the path that produced the sentinel.Ran
just harnessagainst Chromium and theharness-serverQUIC peer, both ways:protocol() returned Noneprotocol() returned Some("")just checkandjust testboth pass.For reviewers
web-transport/src/wasm.rsis comment-only; the router already delegates to the inherent getter, so it inherits the fix.web-transport-wasmis already queued for a breaking0.6.0in chore: release #363.(written by Opus 5)