fix(smtp-transport): Client::read_response infinite loop

I have encountered an issue on Gmail where the server returned an error,
and the code was stuck here looping indefinitely.
This commit fixes the issue.
This commit is contained in:
leo-lb
2019-03-12 01:03:58 +01:00
parent c988b1760a
commit 72f3cd8f12

View File

@@ -254,7 +254,13 @@ impl<S: Connector + Write + Read + Timeout + Debug> InnerClient<S> {
break;
}
// TODO read more than one line
self.stream.as_mut().unwrap().read_line(&mut raw_response)?;
let read_count = self.stream.as_mut().unwrap().read_line(&mut raw_response)?;
// EOF is reached
if read_count == 0 {
break;
}
response = raw_response.parse::<Response>();
}