Skip to content

Commit dd2cb24

Browse files
authored
Fix 100 Continue
A 100 Continue response is an HTTP message in its own right, and must therefore be correctly delineated from the actual response by \r\n\r\n. curl will fail with the current code, as it cannot decode the two HTTP messages correctly.
1 parent 611ca51 commit dd2cb24

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/server/decode.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ fn url_from_httparse_req(req: &httparse::Request<'_, '_>) -> http_types::Result<
128128
}
129129

130130
const EXPECT_HEADER_VALUE: &str = "100-continue";
131-
const EXPECT_RESPONSE: &[u8] = b"HTTP/1.1 100 Continue\r\n";
131+
const EXPECT_RESPONSE: &[u8] = b"HTTP/1.1 100 Continue\r\n\r\n";
132132

133133
async fn handle_100_continue<IO>(req: &Request, io: &mut IO) -> http_types::Result<()>
134134
where
@@ -223,7 +223,7 @@ mod tests {
223223
let result = async_std::task::block_on(handle_100_continue(&request, &mut io));
224224
assert_eq!(
225225
std::str::from_utf8(&io.into_inner()).unwrap(),
226-
"HTTP/1.1 100 Continue\r\n"
226+
"HTTP/1.1 100 Continue\r\n\r\n"
227227
);
228228
assert!(result.is_ok());
229229
}

0 commit comments

Comments
 (0)