Skip to content

Commit

Permalink
remove unwrap
Browse files Browse the repository at this point in the history
  • Loading branch information
soundofspace committed Dec 14, 2024
1 parent ac335dc commit 8cd15ad
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions rama-tls/src/boring/server/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,13 +221,20 @@ where
.flatten()
{
// peer_cert_chain doesn't contain the leaf certificate in a server ctx
let mut chain = stream.ssl().peer_cert_chain().map_or(vec![], |chain| {
let mut chain = stream.ssl().peer_cert_chain().map_or(Ok(vec![]), |chain| {
chain
.into_iter()
.map(|cert| cert.to_der().unwrap())
.collect()
});
chain.insert(0, certificate.to_der().unwrap());
.map(|cert| {
cert.to_der()
.context("boring ssl session: failed to convert peer certificates to der")
})
.collect::<Result<Vec<Vec<u8>>, _>>()
})?;

let certificate = certificate
.to_der()
.context("boring ssl session: failed to convert peer certificate to der")?;
chain.insert(0, certificate);
Some(DataEncoding::DerStack(chain))
} else {
None
Expand Down

0 comments on commit 8cd15ad

Please sign in to comment.