From 2607d45e7a61c2427348f10d0115ae713e4e9af3 Mon Sep 17 00:00:00 2001 From: Jordan Doyle Date: Mon, 20 Jul 2020 00:29:49 +0100 Subject: [PATCH] Correctly return a 100 Continue to streaming clients that expect it --- scrs-serve/src/main.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/scrs-serve/src/main.rs b/scrs-serve/src/main.rs index 13fe317..d712604 100644 --- a/scrs-serve/src/main.rs +++ a/scrs-serve/src/main.rs @@ -186,10 +186,18 @@ let mut resp = resp .header("Connection", "Close") - .header("Allow", "PUT, SOURCE") - .body(()) - .unwrap(); - write_response(&mut stream, resp).await; + .header("Allow", "PUT, SOURCE"); + + let expect_header = req + .headers() + .get("expect") + .map(http::HeaderValue::as_bytes) + .unwrap_or_default(); + if expect_header == b"100-continue" { + resp = resp.status(100); + } + + write_response(&mut stream, resp.body(()).unwrap()).await; loop { if stream.read_buf(&mut buffer).await.unwrap() == 0 { -- rgit 0.1.3