You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When handling the response from an OHTTP relay, we must decapsulate (decrypt) the relay's response and then decode the relay's response body into a bhttp::Message. To get the HTTP status of the encapsulated response, I then have to examine the bhttp::ControlData, which is either ControlData::Request or ::Response.
This is awkward, because if I'm decapsulating a response, why would it ever be ControlData::Request? In glean (which IIUC goes into Firefox), they handle this by using ControlData::status -> Option<StatusCode>, and wrapping the None case in a fatal error. I had to write similarly annoying code in Janus.
Here's my suggestion: we know from context that we expect a response and only a response. Additionally, we already have to handle decoding errors that might arise from Message::read_bhttp. What if instead of Message, there were explicit Request and Response types, and their read_bhttp methods would fail if the bytes couldn't be decoded as a request or response, respectively? I think this would also resolve some ambiguity around Message's informational_response field.
The text was updated successfully, but these errors were encountered:
When handling the response from an OHTTP relay, we must decapsulate (decrypt) the relay's response and then decode the relay's response body into a
bhttp::Message
. To get the HTTP status of the encapsulated response, I then have to examine thebhttp::ControlData
, which is eitherControlData::Request
or::Response
.This is awkward, because if I'm decapsulating a response, why would it ever be
ControlData::Request
? In glean (which IIUC goes into Firefox), they handle this by usingControlData::status -> Option<StatusCode>
, and wrapping theNone
case in a fatal error. I had to write similarly annoying code in Janus.Here's my suggestion: we know from context that we expect a response and only a response. Additionally, we already have to handle decoding errors that might arise from
Message::read_bhttp
. What if instead ofMessage
, there were explicitRequest
andResponse
types, and theirread_bhttp
methods would fail if the bytes couldn't be decoded as a request or response, respectively? I think this would also resolve some ambiguity aroundMessage
'sinformational_response
field.The text was updated successfully, but these errors were encountered: