added a comment on the possible http messages

This commit is contained in:
Alessandro Caprarelli 2021-10-14 09:51:01 +02:00
parent 64afceea5f
commit 9ef0dd6915

View file

@ -217,6 +217,15 @@ async fn assert_retry_on_request_timeout() {
#[tokio::test] #[tokio::test]
async fn assert_retry_on_incomplete_message() { async fn assert_retry_on_incomplete_message() {
// Following the HTTP/1.1 specification (https://en.wikipedia.org/wiki/HTTP_message_body) a valid response contains:
// - status line
// - headers
// - empty line
// - optional message body
//
// After a few tries we have noticed that:
// - "message_that_makes_no_sense" triggers a hyper::ParseError because the format is completely wrong
// - "HTTP/1.1" triggers a hyper::IncompleteMessage because the format is correct until that point but misses mandatory parts
let incomplete_message = "HTTP/1.1"; let incomplete_message = "HTTP/1.1";
let complete_message = "HTTP/1.1 200 OK\r\n\r\n"; let complete_message = "HTTP/1.1 200 OK\r\n\r\n";