You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a application, that lets you select the desired ssl mode.
use_tls: bool,
//https://docs.rs/sqlx/latest/sqlx/postgres/enum.PgSslMode.html
let connect_options = PgConnectOptions::new()
.host(host)
.port(port.parse().unwrap_or(5432))
.username(user)
.password(password)
.database(database)
.ssl_mode(match use_tls {
true => PgSslMode::Require,
false => PgSslMode::Allow,
});
match postgres::PgPool::connect_with(connect_options).await {
Ok(x) => {
drop(connection.0.write().await.replace(x));
return Ok(format!("SUCCESS"));
}
Err(_) => return Err(format!("Couldn't connect to the database!")),
}
In case of true we will require a ssl mode and in case of false we'll try with no ssl mode but fall back to ssl if we can not connect otherwise.
I am using a Postgres15 database that is hosted on fl0.com.
The database has SSL mode set to require.
When trying to connecto to it with PgSslMode::Require it works perfectly fine but when trying to use PgSslMode::Allow it doesn't connect.
My expectations: When i try to establish a connection to s SSL require db with the ssl_mode set to PgSslMode::Allow it will try to connect to it 2 times. First without any SSL and if that fails it will try a SSl connection.
The code doesn't work as expected, neither on macOS nor on Windows.
I am using the following sqlx features (Cargo.toml):
sqlx = { version = "0.7.3", features = [
"postgres",
"runtime-tokio",
"tls-native-tls",
]
And I have also tried it with tls-rustls with the same results.
Is this a bug or am I expecting something that isn't true?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have a application, that lets you select the desired ssl mode.
In case of true we will require a ssl mode and in case of false we'll try with no ssl mode but fall back to ssl if we can not connect otherwise.
I am using a Postgres15 database that is hosted on fl0.com.
The database has SSL mode set to require.
When trying to connecto to it with PgSslMode::Require it works perfectly fine but when trying to use PgSslMode::Allow it doesn't connect.
My expectations: When i try to establish a connection to s SSL require db with the ssl_mode set to PgSslMode::Allow it will try to connect to it 2 times. First without any SSL and if that fails it will try a SSl connection.
The code doesn't work as expected, neither on macOS nor on Windows.
I am using the following sqlx features (Cargo.toml):
And I have also tried it with tls-rustls with the same results.
Is this a bug or am I expecting something that isn't true?
Beta Was this translation helpful? Give feedback.
All reactions