Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Don’t try to send a body with a GET request
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Demi-Marie committed Sep 26, 2019
1 parent 63535b0 commit d18d3c1
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions core/offchain/src/api/http.rs
Expand Up @@ -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();
Expand All @@ -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();
Expand All @@ -866,44 +866,44 @@ 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) {
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.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) {
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, &[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) => {}
Expand Down

0 comments on commit d18d3c1

Please sign in to comment.