Skip to content

Commit 2bb0933

Browse files
committed
Revert "support overriding the tls host"
This reverts commit 7324560.
1 parent b759caa commit 2bb0933

File tree

2 files changed

+5
-20
lines changed

2 files changed

+5
-20
lines changed

tokio-postgres/src/config.rs

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,6 @@ pub struct Config {
195195
pub(crate) target_session_attrs: TargetSessionAttrs,
196196
pub(crate) channel_binding: ChannelBinding,
197197
pub(crate) replication_mode: Option<ReplicationMode>,
198-
pub(crate) tls_verify_host: Option<String>,
199198
}
200199

201200
impl Default for Config {
@@ -231,7 +230,6 @@ impl Config {
231230
target_session_attrs: TargetSessionAttrs::Any,
232231
channel_binding: ChannelBinding::Prefer,
233232
replication_mode: None,
234-
tls_verify_host: None,
235233
}
236234
}
237235

@@ -375,24 +373,12 @@ impl Config {
375373
&self.host
376374
}
377375

378-
/// Gets a mutable view of the hosts that have been added to the configuration with `host`.
376+
/// Gets a mutable view of the hosts that have been added to the
377+
/// configuration with `host`.
379378
pub fn get_hosts_mut(&mut self) -> &mut [Host] {
380379
&mut self.host
381380
}
382381

383-
/// Sets the hostname used during TLS certificate verification, if enabled.
384-
///
385-
/// This can be useful if you are connecting through an SSH tunnel.
386-
pub fn tls_verify_host(&mut self, host: &str) -> &mut Config {
387-
self.tls_verify_host = Some(host.to_string());
388-
self
389-
}
390-
391-
/// Gets the host that has been added to the configuration with `tls_verify_host`.
392-
pub fn get_tls_verify_host(&self) -> Option<&str> {
393-
self.tls_verify_host.as_deref()
394-
}
395-
396382
/// Adds a Unix socket host to the configuration.
397383
///
398384
/// Unlike `host`, this method allows non-UTF8 paths.

tokio-postgres/src/connect.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,11 @@ where
3232
.copied()
3333
.unwrap_or(5432);
3434

35-
let hostname = match (config.tls_verify_host.as_deref(), host) {
36-
(Some(tls_verify_host), Host::Tcp(_)) => tls_verify_host,
37-
(None, Host::Tcp(host)) => host.as_str(),
35+
let hostname = match host {
36+
Host::Tcp(host) => host.as_str(),
3837
// postgres doesn't support TLS over unix sockets, so the choice here doesn't matter
3938
#[cfg(unix)]
40-
(_, Host::Unix(_)) => "",
39+
Host::Unix(_) => "",
4140
};
4241

4342
let tls = tls

0 commit comments

Comments
 (0)