Make :status in requests be a stream error

This commit is contained in:
Anthony Ramine
2021-10-19 12:40:27 +02:00
committed by Sean McArthur
parent 8520f06f93
commit c38c94cb16
4 changed files with 39 additions and 4 deletions

View File

@@ -575,6 +575,11 @@ impl Pseudo {
}
}
#[cfg(feature = "unstable")]
pub fn set_status(&mut self, value: StatusCode) {
self.status = Some(value);
}
pub fn set_scheme(&mut self, scheme: uri::Scheme) {
let bytes_str = match scheme.as_str() {
"http" => BytesStr::from_static("http"),

View File

@@ -1410,10 +1410,8 @@ impl proto::Peer for Peer {
malformed!("malformed headers: missing method");
}
// Specifying :status for a request is a protocol error
if pseudo.status.is_some() {
tracing::trace!("malformed headers: :status field on request; PROTOCOL_ERROR");
return Err(Error::library_go_away(Reason::PROTOCOL_ERROR));
malformed!("malformed headers: :status field on request");
}
// Convert the URI