Skip to content

Commit

Permalink
fix #762 (#763)
Browse files Browse the repository at this point in the history
move tle key reader out from loop to avoid infinity loop
  • Loading branch information
4t145 authored Feb 29, 2024
1 parent e3b2201 commit c70db14
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions poem/src/listener/rustls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ impl RustlsCertificate {
let cert = rustls_pemfile::certs(&mut self.cert.as_slice())
.collect::<Result<_, _>>()
.map_err(|_| IoError::new(ErrorKind::Other, "failed to parse tls certificates"))?;

let mut key_reader = self.key.as_slice();
let priv_key = loop {
match rustls_pemfile::read_one(&mut self.key.as_slice())? {
match rustls_pemfile::read_one(&mut key_reader)? {
Some(Item::Pkcs1Key(key)) => break key.into(),
Some(Item::Pkcs8Key(key)) => break key.into(),
Some(Item::Sec1Key(key)) => break key.into(),
Expand Down

0 comments on commit c70db14

Please sign in to comment.