Skip 1xx frames in more states (#527)

#524

Co-authored-by: Kornel <kornel@cloudflare.com>
This commit is contained in:
Anthony Ramine
2021-03-24 16:03:12 +01:00
committed by GitHub
parent 7a5b574d8e
commit a1f914f46f
2 changed files with 63 additions and 6 deletions

View File

@@ -132,11 +132,8 @@ impl State {
/// Opens the receive-half of the stream when a HEADERS frame is received.
///
/// is_informational: whether received a 1xx status code
///
/// Returns true if this transitions the state to Open.
pub fn recv_open(&mut self, frame: &frame::Headers) -> Result<bool, RecvError> {
let remote = Streaming;
let mut initial = false;
let eos = frame.is_end_stream();
@@ -149,7 +146,12 @@ impl State {
} else {
Open {
local: AwaitingHeaders,
remote,
remote: if frame.is_informational() {
tracing::trace!("skipping 1xx response headers");
AwaitingHeaders
} else {
Streaming
},
}
}
}
@@ -158,6 +160,9 @@ impl State {
if eos {
Closed(Cause::EndStream)
} else if frame.is_informational() {
tracing::trace!("skipping 1xx response headers");
ReservedRemote
} else {
HalfClosedLocal(Streaming)
}
@@ -169,7 +174,15 @@ impl State {
if eos {
HalfClosedRemote(local)
} else {
Open { local, remote }
Open {
local,
remote: if frame.is_informational() {
tracing::trace!("skipping 1xx response headers");
AwaitingHeaders
} else {
Streaming
},
}
}
}
HalfClosedLocal(AwaitingHeaders) => {
@@ -179,7 +192,7 @@ impl State {
tracing::trace!("skipping 1xx response headers");
HalfClosedLocal(AwaitingHeaders)
} else {
HalfClosedLocal(remote)
HalfClosedLocal(Streaming)
}
}
state => {