Skip to content

Commit

Permalink
H3: fix non-idempotent rejection on server 0-RTT
Browse files Browse the repository at this point in the history
  • Loading branch information
stammw committed May 4, 2020
1 parent f4290a4 commit 71fa9ea
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion quinn-h3/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -594,10 +594,20 @@ impl RecvRequest {
}
}

fn build_request(&self, headers: Header, body: RecvBody) -> Result<Request<RecvBody>, Error> {
fn build_request(
&mut self,
headers: Header,
body: RecvBody,
) -> Result<Request<RecvBody>, Error> {
let (method, uri, headers) = headers.into_request_parts()?;

if self.is_0rtt && !method.is_idempotent() {
if let Some(r) = &mut self.recv {
r.reset(ErrorCode::REQUEST_REJECTED);
}
if let Some(s) = &mut self.send {
s.reset(ErrorCode::REQUEST_REJECTED.into());
}
return Err(Error::peer(format!(
"Tried an non indempotent method in 0-RTT: {}",
method,
Expand Down

0 comments on commit 71fa9ea

Please sign in to comment.