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:
@@ -418,7 +418,10 @@ impl Response {
|
||||
fn do_from_read(mut reader: impl Read) -> Result<Response, Error> {
|
||||
//
|
||||
// HTTP/1.1 200 OK\r\n
|
||||
let status_line = read_next_line(&mut reader).map_err(|_| Error::BadStatus)?;
|
||||
let status_line = read_next_line(&mut reader).map_err(|e| match e.kind() {
|
||||
ErrorKind::ConnectionAborted => Error::BadStatusRead,
|
||||
_ => Error::BadStatus,
|
||||
})?;
|
||||
|
||||
let (index, status) = parse_status_line(status_line.as_str())?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user