Retry some pooled connections failing when server closes. Close #10

This is not a perfect solution. It works as long as we are not sending
any body bytes. We discover the error first when attempting to read
the response status line. That means we discover the error after
sending body bytes. To be able to re-send the body, we would need to
introduce a buffer to be able to replay the body on the next
request. We don't currently do that.
This commit is contained in:
Martin Algesten
2019-10-20 21:32:19 +02:00
parent 1264213ca6
commit 753d61b454
5 changed files with 64 additions and 8 deletions

View File

@@ -105,13 +105,13 @@ pub(crate) fn send_body(
mut body: SizedReader,
do_chunk: bool,
stream: &mut Stream,
) -> IoResult<()> {
if do_chunk {
) -> IoResult<u64> {
let n = if do_chunk {
let mut chunker = chunked_transfer::Encoder::new(stream);
copy(&mut body.reader, &mut chunker)?;
copy(&mut body.reader, &mut chunker)?
} else {
copy(&mut body.reader, stream)?;
}
copy(&mut body.reader, stream)?
};
Ok(())
Ok(n)
}