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:
12
src/body.rs
12
src/body.rs
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user