From d18d3c1aae0d967a2aeb170a56e9964e99d172eb Mon Sep 17 00:00:00 2001 From: "Demi M. Obenour" Date: Thu, 26 Sep 2019 14:55:09 -0400 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20try=20to=20send=20a=20body=20wi?= =?UTF-8?q?th=20a=20GET=20request?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit without adding a Transfer-Encoding or Content-Length header. This has always been wrong, but hyperium/hyper#1925 hid the bug until hyper was upgraded to 0.12.35. --- core/offchain/src/api/http.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/core/offchain/src/api/http.rs b/core/offchain/src/api/http.rs index 9ea666862c3d9..478f9454235d4 100644 --- a/core/offchain/src/api/http.rs +++ b/core/offchain/src/api/http.rs @@ -848,7 +848,7 @@ mod tests { _ => panic!() }; - let id = api.request_start("GET", &format!("http://{}", addr)).unwrap(); + let id = api.request_start("POST", &format!("http://{}", addr)).unwrap(); api.request_write_body(id, &[1, 2, 3, 4], None).unwrap(); api.request_write_body(id, &[1, 2, 3, 4], None).unwrap(); api.request_write_body(id, &[], None).unwrap(); @@ -857,7 +857,7 @@ mod tests { _ => panic!() }; - let id = api.request_start("GET", &format!("http://{}", addr)).unwrap(); + let id = api.request_start("POST", &format!("http://{}", addr)).unwrap(); api.request_write_body(id, &[1, 2, 3, 4], None).unwrap(); api.request_write_body(id, &[1, 2, 3, 4], None).unwrap(); api.request_write_body(id, &[], None).unwrap(); @@ -866,7 +866,7 @@ mod tests { _ => panic!() }; - let id = api.request_start("GET", &format!("http://{}", addr)).unwrap(); + let id = api.request_start("POST", &format!("http://{}", addr)).unwrap(); api.request_write_body(id, &[1, 2, 3, 4], None).unwrap(); api.response_wait(&[id], None); match api.request_write_body(id, &[], None) { @@ -874,7 +874,7 @@ mod tests { _ => panic!() }; - let id = api.request_start("GET", &format!("http://{}", addr)).unwrap(); + let id = api.request_start("POST", &format!("http://{}", addr)).unwrap(); api.request_write_body(id, &[1, 2, 3, 4], None).unwrap(); api.response_wait(&[id], None); match api.request_write_body(id, &[1, 2, 3, 4], None) { @@ -882,28 +882,28 @@ mod tests { _ => panic!() }; - let id = api.request_start("GET", &format!("http://{}", addr)).unwrap(); + let id = api.request_start("POST", &format!("http://{}", addr)).unwrap(); api.response_headers(id); match api.request_write_body(id, &[1, 2, 3, 4], None) { Err(HttpError::Invalid) => {} _ => panic!() }; - let id = api.request_start("GET", &format!("http://{}", addr)).unwrap(); + let id = api.request_start("POST", &format!("http://{}", addr)).unwrap(); api.response_headers(id); match api.request_write_body(id, &[], None) { Err(HttpError::Invalid) => {} _ => panic!() }; - let id = api.request_start("GET", &format!("http://{}", addr)).unwrap(); + let id = api.request_start("POST", &format!("http://{}", addr)).unwrap(); api.response_read_body(id, &mut [], None).unwrap(); match api.request_write_body(id, &[1, 2, 3, 4], None) { Err(HttpError::Invalid) => {} _ => panic!() }; - let id = api.request_start("GET", &format!("http://{}", addr)).unwrap(); + let id = api.request_start("POST", &format!("http://{}", addr)).unwrap(); api.response_read_body(id, &mut [], None).unwrap(); match api.request_write_body(id, &[], None) { Err(HttpError::Invalid) => {}