Skip to content

Commit 3560e37

Browse files
authored
Merge pull request #340 from paolobarbolini/drop-webpki
Drop unused `webpki` dependency
2 parents e3bf3fa + 89bebf0 commit 3560e37

File tree

3 files changed

+4
-31
lines changed

3 files changed

+4
-31
lines changed

Cargo.toml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,6 @@ optional = true
6161
version = "2.1.0"
6262
optional = true
6363

64-
[dependencies.webpki]
65-
version = ">=0.22.1"
66-
features = ["std"]
67-
optional = true
68-
6964
[dependencies.webpki-roots]
7065
version = "0.26.1"
7166
optional = true
@@ -102,7 +97,6 @@ native-tls-tls = ["native-tls", "tokio-native-tls"]
10297
rustls-tls = [
10398
"rustls",
10499
"tokio-rustls",
105-
"webpki",
106100
"webpki-roots",
107101
"rustls-pemfile",
108102
]

src/error/tls/rustls_error.rs

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ use rustls::server::VerifierBuilderError;
77
#[derive(Debug)]
88
pub enum TlsError {
99
Tls(rustls::Error),
10-
Pki(webpki::Error),
11-
InvalidDnsName(webpki::InvalidDnsNameError),
10+
InvalidDnsName(rustls::pki_types::InvalidDnsNameError),
1211
VerifierBuilderError(VerifierBuilderError),
1312
}
1413

@@ -30,41 +29,22 @@ impl From<rustls::Error> for TlsError {
3029
}
3130
}
3231

33-
impl From<webpki::InvalidDnsNameError> for TlsError {
34-
fn from(e: webpki::InvalidDnsNameError) -> Self {
32+
impl From<rustls::pki_types::InvalidDnsNameError> for TlsError {
33+
fn from(e: rustls::pki_types::InvalidDnsNameError) -> Self {
3534
TlsError::InvalidDnsName(e)
3635
}
3736
}
3837

39-
impl From<webpki::Error> for TlsError {
40-
fn from(e: webpki::Error) -> Self {
41-
TlsError::Pki(e)
42-
}
43-
}
44-
4538
impl From<rustls::Error> for crate::Error {
4639
fn from(e: rustls::Error) -> Self {
4740
crate::Error::Io(crate::error::IoError::Tls(e.into()))
4841
}
4942
}
5043

51-
impl From<webpki::Error> for crate::Error {
52-
fn from(e: webpki::Error) -> Self {
53-
crate::Error::Io(crate::error::IoError::Tls(e.into()))
54-
}
55-
}
56-
57-
impl From<webpki::InvalidDnsNameError> for crate::Error {
58-
fn from(e: webpki::InvalidDnsNameError) -> Self {
59-
crate::Error::Io(crate::error::IoError::Tls(e.into()))
60-
}
61-
}
62-
6344
impl std::error::Error for TlsError {
6445
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
6546
match self {
6647
TlsError::Tls(e) => Some(e),
67-
TlsError::Pki(e) => Some(e),
6848
TlsError::InvalidDnsName(e) => Some(e),
6949
TlsError::VerifierBuilderError(e) => Some(e),
7050
}
@@ -75,7 +55,6 @@ impl Display for TlsError {
7555
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
7656
match self {
7757
TlsError::Tls(e) => e.fmt(f),
78-
TlsError::Pki(e) => e.fmt(f),
7958
TlsError::InvalidDnsName(e) => e.fmt(f),
8059
TlsError::VerifierBuilderError(e) => e.fmt(f),
8160
}

src/io/tls/rustls_io.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ impl Endpoint {
8585
let stream = stream.take().unwrap();
8686

8787
let server_name = ServerName::try_from(domain.as_str())
88-
.map_err(|_| webpki::InvalidDnsNameError)?
88+
.map_err(TlsError::InvalidDnsName)?
8989
.to_owned();
9090
let connection = tls_connector.connect(server_name, stream).await?;
9191

0 commit comments

Comments
 (0)