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

Commit d18d3c1

Browse files
committed
Don’t try to send a body with a GET request
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.
1 parent 63535b0 commit d18d3c1

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

core/offchain/src/api/http.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,7 @@ mod tests {
848848
_ => panic!()
849849
};
850850

851-
let id = api.request_start("GET", &format!("http://{}", addr)).unwrap();
851+
let id = api.request_start("POST", &format!("http://{}", addr)).unwrap();
852852
api.request_write_body(id, &[1, 2, 3, 4], None).unwrap();
853853
api.request_write_body(id, &[1, 2, 3, 4], None).unwrap();
854854
api.request_write_body(id, &[], None).unwrap();
@@ -857,7 +857,7 @@ mod tests {
857857
_ => panic!()
858858
};
859859

860-
let id = api.request_start("GET", &format!("http://{}", addr)).unwrap();
860+
let id = api.request_start("POST", &format!("http://{}", addr)).unwrap();
861861
api.request_write_body(id, &[1, 2, 3, 4], None).unwrap();
862862
api.request_write_body(id, &[1, 2, 3, 4], None).unwrap();
863863
api.request_write_body(id, &[], None).unwrap();
@@ -866,44 +866,44 @@ mod tests {
866866
_ => panic!()
867867
};
868868

869-
let id = api.request_start("GET", &format!("http://{}", addr)).unwrap();
869+
let id = api.request_start("POST", &format!("http://{}", addr)).unwrap();
870870
api.request_write_body(id, &[1, 2, 3, 4], None).unwrap();
871871
api.response_wait(&[id], None);
872872
match api.request_write_body(id, &[], None) {
873873
Err(HttpError::Invalid) => {}
874874
_ => panic!()
875875
};
876876

877-
let id = api.request_start("GET", &format!("http://{}", addr)).unwrap();
877+
let id = api.request_start("POST", &format!("http://{}", addr)).unwrap();
878878
api.request_write_body(id, &[1, 2, 3, 4], None).unwrap();
879879
api.response_wait(&[id], None);
880880
match api.request_write_body(id, &[1, 2, 3, 4], None) {
881881
Err(HttpError::Invalid) => {}
882882
_ => panic!()
883883
};
884884

885-
let id = api.request_start("GET", &format!("http://{}", addr)).unwrap();
885+
let id = api.request_start("POST", &format!("http://{}", addr)).unwrap();
886886
api.response_headers(id);
887887
match api.request_write_body(id, &[1, 2, 3, 4], None) {
888888
Err(HttpError::Invalid) => {}
889889
_ => panic!()
890890
};
891891

892-
let id = api.request_start("GET", &format!("http://{}", addr)).unwrap();
892+
let id = api.request_start("POST", &format!("http://{}", addr)).unwrap();
893893
api.response_headers(id);
894894
match api.request_write_body(id, &[], None) {
895895
Err(HttpError::Invalid) => {}
896896
_ => panic!()
897897
};
898898

899-
let id = api.request_start("GET", &format!("http://{}", addr)).unwrap();
899+
let id = api.request_start("POST", &format!("http://{}", addr)).unwrap();
900900
api.response_read_body(id, &mut [], None).unwrap();
901901
match api.request_write_body(id, &[1, 2, 3, 4], None) {
902902
Err(HttpError::Invalid) => {}
903903
_ => panic!()
904904
};
905905

906-
let id = api.request_start("GET", &format!("http://{}", addr)).unwrap();
906+
let id = api.request_start("POST", &format!("http://{}", addr)).unwrap();
907907
api.response_read_body(id, &mut [], None).unwrap();
908908
match api.request_write_body(id, &[], None) {
909909
Err(HttpError::Invalid) => {}

0 commit comments

Comments
 (0)