Correctly return a 100 Continue to streaming clients that expect it
Diff
scrs-serve/src/main.rs | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
@@ -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 {