Handle ConnectionReset+ConnectionAbort at any time (#168)
Previously we had a special case for BadStatusRead that would happen only when we got a ConnectionAborted error reading the status line. However, sometimes we get ConnectionReset instead. Also the HTTP spec says that idempotent requests may be retried anytime a connection is closed prematurely. The change treats as retryable any ConnectionAborted OR ConnectionReset error while reading the status line and headers. It removes the special case BadStatusRead error. Fixes #165 (I think).
This commit is contained in:
committed by
GitHub
parent
065b560dfb
commit
17d7e147eb
@@ -476,10 +476,7 @@ 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(|e| match e.kind() {
|
||||
ErrorKind::ConnectionAborted => Error::BadStatusRead,
|
||||
_ => Error::Io(e),
|
||||
})?;
|
||||
let status_line = read_next_line(&mut reader)?;
|
||||
|
||||
let (index, status) = parse_status_line(status_line.as_str())?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user