Skip to content
This repository has been archived by the owner on Sep 4, 2024. It is now read-only.

Commit

Permalink
simple_http: rename writeable version of sock to write_sock
Browse files Browse the repository at this point in the history
  • Loading branch information
apoelstra committed Jan 25, 2023
1 parent cfc4e6f commit 1d11885
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/simple_http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,24 +177,24 @@ impl SimpleHttpTransport {

// Send HTTP request
{
let mut sock = BufWriter::new(sock.get_mut());
sock.write_all(b"POST ")?;
sock.write_all(self.path.as_bytes())?;
sock.write_all(b" HTTP/1.1\r\n")?;
let mut write_sock = BufWriter::new(sock.get_mut());
write_sock.write_all(b"POST ")?;
write_sock.write_all(self.path.as_bytes())?;
write_sock.write_all(b" HTTP/1.1\r\n")?;
// Write headers
sock.write_all(b"Content-Type: application/json\r\n")?;
sock.write_all(b"Content-Length: ")?;
sock.write_all(body.len().to_string().as_bytes())?;
sock.write_all(b"\r\n")?;
write_sock.write_all(b"Content-Type: application/json\r\n")?;
write_sock.write_all(b"Content-Length: ")?;
write_sock.write_all(body.len().to_string().as_bytes())?;
write_sock.write_all(b"\r\n")?;
if let Some(ref auth) = self.basic_auth {
sock.write_all(b"Authorization: ")?;
sock.write_all(auth.as_ref())?;
sock.write_all(b"\r\n")?;
write_sock.write_all(b"Authorization: ")?;
write_sock.write_all(auth.as_ref())?;
write_sock.write_all(b"\r\n")?;
}
// Write body
sock.write_all(b"\r\n")?;
sock.write_all(&body)?;
sock.flush()?;
write_sock.write_all(b"\r\n")?;
write_sock.write_all(&body)?;
write_sock.flush()?;
}

// Parse first HTTP response header line
Expand Down

0 comments on commit 1d11885

Please sign in to comment.