History

[clone] non-deterministic behaviour when parsing HTML, despite ignoring the encoding

Is it the mock server, or is it curl? Or is it the mock data? And why can barebones curl download the file in the first place?

Sebastian Thiel committed 6 years ago

Commit bab3ec31 parent 49f1aca4 files · +9 −7Browse files

Unified · Split

4 files
  1. Cargo.lock +2 −2
  2. git-transport/Cargo.toml +1 −1
  3. git-transport/src/client/http/curl.rs +5 −4
  4. git-transport/tests/client/http.rs +1 −0
Cargo.lock+2−2
@@ -409,9 +409,9 @@ dependencies = [ · 408 unmodified lines
409 409
410[[package]]410[[package]]
411name = "curl"411name = "curl"
412version = "0.4.33"412version = "0.4.23"
413source = "registry+https://github.com/rust-lang/crates.io-index"413source = "registry+https://github.com/rust-lang/crates.io-index"
414checksum = "78baca05127a115136a9898e266988fc49ca7ea2c839f60fc6e1fc9df1599168"414checksum = "d6458247e474561f731d5c13cb5c83c91f752eee770c431d50d22cb07d006e91"
415dependencies = [415dependencies = [
416 "curl-sys",416 "curl-sys",
417 "libc",417 "libc",
git-transport/Cargo.toml+1−1
@@ -27,5 +27,5 @@ quick-error = "2.0.0" · 26 unmodified lines
27bstr = { version = "0.2.13", default-features = false, features = ["std"] }27bstr = { version = "0.2.13", default-features = false, features = ["std"] }
28 28
29# for http-client-curl29# for http-client-curl
30curl = { version = "0.4.31", optional = true, features = ["static-ssl", "static-curl"] }30curl = { version = "0.4", optional = true, features = ["static-ssl", "static-curl"] }
31thiserror = "1.0.20"31thiserror = "1.0.20"
git-transport/src/client/http/curl.rs+5−4
@@ -127,16 +127,17 @@ fn new_remote_curl() -> ( · 126 unmodified lines
127 let (res_send, res_recv) = sync_channel(0);127 let (res_send, res_recv) = sync_channel(0);
128 let handle = std::thread::spawn(move || -> Result<(), curl::Error> {128 let handle = std::thread::spawn(move || -> Result<(), curl::Error> {
129 let mut handle = Easy2::new(Handler::default());129 let mut handle = Easy2::new(Handler::default());
130 // GitHub sends 'chunked' to avoid unknown clients to choke on the data, I suppose
131 handle.transfer_encoding(false)?;
132 handle.http_transfer_decoding(false)?;
133 handle.http_content_decoding(false)?;
134 130
135 for Request { url, headers, upload } in req_recv {131 for Request { url, headers, upload } in req_recv {
136 handle.url(&url)?;132 handle.url(&url)?;
133
134 // GitHub sends 'chunked' to avoid unknown clients to choke on the data, I suppose
137 handle.upload(upload)?;135 handle.upload(upload)?;
138 handle.post(upload)?;136 handle.post(upload)?;
139 handle.http_headers(headers)?;137 handle.http_headers(headers)?;
138 handle.transfer_encoding(false)?;
139 handle.http_transfer_decoding(false)?;
140 handle.http_content_decoding(false)?;
140 141
141 let (receive_data, receive_headers, send_body) = {142 let (receive_data, receive_headers, send_body) = {
142 let handler = handle.get_mut();143 let handler = handle.get_mut();
git-transport/tests/client/http.rs+1−0
@@ -69,6 +69,7 @@ mod upload_pack { · 68 unmodified lines
69 use git_transport::{client::TransportSketch, Protocol, Service};69 use git_transport::{client::TransportSketch, Protocol, Service};
70 70
71 #[test]71 #[test]
72 #[ignore]
72 fn clone_v1() -> crate::Result {73 fn clone_v1() -> crate::Result {
73 let mut server = serve_once("v1/http-handshake.response");74 let mut server = serve_once("v1/http-handshake.response");
74 let mut c = git_transport::client::http::connect(75 let mut c = git_transport::client::http::connect(