sfackler / rust-postgres

Native PostgreSQL driver for the Rust programming language
Apache License 2.0
3.39k stars 429 forks source link

feat: sslnegotiation and direct ssl for postgres 17 #1151

Open sunng87 opened 1 week ago

sunng87 commented 1 week ago

This patch adds Direct SSL support which is a new feature coming in PostgreSQL 17. With this option, we issue TLS handshake directly without SslRequest. This will save a roundtrip on connection opening.

I just follow how libpq is designed, to offer an option sslnegotiation to control this behaviour (because it won't work on Postgres 16 or earlier).

sfackler commented 1 week ago

Seems reasonable to me, but I think it might make sense to wait on merging until 17 releases.

sunng87 commented 1 week ago

No problem. I'm using this to test my own postgresql wire protocol implementation

And the clippy issue seems not related to this patch, I can create another one to fix that. Edit: Just saw it's been fixed on default branch