Skip to content

Commit

Permalink
[clone] for good measure: configure posts (more) correctly
Browse files Browse the repository at this point in the history
Yet, the chunked encoding kills it.
  • Loading branch information
Byron committed Aug 22, 2020
1 parent 3a1b8bc commit e491e58
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions git-transport/src/client/http/curl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ impl Curl {
&mut self,
url: &str,
headers: impl IntoIterator<Item = impl AsRef<str>>,
upload: bool,
) -> Result<http::PostResponse<pipe::Reader, pipe::Reader, pipe::Writer>, http::Error> {
let mut list = curl::easy::List::new();
for header in headers {
Expand All @@ -68,6 +69,7 @@ impl Curl {
.send(Request {
url: url.to_owned(),
headers: list,
upload,
})
.is_err()
{
Expand Down Expand Up @@ -107,6 +109,7 @@ impl Curl {
struct Request {
url: String,
headers: curl::easy::List,
upload: bool,
}

struct Response {
Expand All @@ -128,8 +131,10 @@ fn new_remote_curl() -> (
handle.transfer_encoding(false)?;
handle.http_transfer_decoding(false)?;

for Request { url, headers } in req_recv {
for Request { url, headers, upload } in req_recv {
handle.url(&url)?;
handle.upload(upload)?;
handle.post(upload)?;
handle.http_headers(headers)?;

let (receive_data, receive_headers, send_body) = {
Expand Down Expand Up @@ -201,14 +206,14 @@ impl crate::client::http::Http for Curl {
url: &str,
headers: impl IntoIterator<Item = impl AsRef<str>>,
) -> Result<http::GetResponse<Self::Headers, Self::ResponseBody>, http::Error> {
self.make_request(url, headers).map(Into::into)
self.make_request(url, headers, false).map(Into::into)
}

fn post(
&mut self,
url: &str,
headers: impl IntoIterator<Item = impl AsRef<str>>,
) -> Result<http::PostResponse<Self::Headers, Self::ResponseBody, Self::PostBody>, http::Error> {
self.make_request(url, headers)
self.make_request(url, headers, true)
}
}

0 comments on commit e491e58

Please sign in to comment.