mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-01-28 12:04:13 +00:00
require TLS close_notify, add comments
This commit is contained in:
parent
dbfc02318b
commit
5176ff715a
@ -433,16 +433,25 @@ impl Page {
|
||||
certificate: Option<TlsCertificate>,
|
||||
) -> impl IsA<IOStream> {
|
||||
if let Some(certificate) = certificate {
|
||||
// https://geminiprotocol.net/docs/protocol-specification.gmi#the-use-of-tls
|
||||
let tls_connection =
|
||||
TlsClientConnection::new(&connection, Some(&connectable)).unwrap(); // @TODO handle
|
||||
|
||||
// https://geminiprotocol.net/docs/protocol-specification.gmi#client-certificates
|
||||
tls_connection.set_certificate(&certificate);
|
||||
|
||||
// @TODO handle exceptions
|
||||
// https://geminiprotocol.net/docs/protocol-specification.gmi#closing-connections
|
||||
tls_connection.set_require_close_notify(true);
|
||||
|
||||
// @TODO manual validation
|
||||
// https://geminiprotocol.net/docs/protocol-specification.gmi#tls-server-certificate-validation
|
||||
tls_connection.connect_accept_certificate(move |_, _, _| true);
|
||||
|
||||
// Take encrypted I/O stream
|
||||
tls_connection.upcast::<IOStream>()
|
||||
} else {
|
||||
// Take default I/O stream
|
||||
connection.upcast::<IOStream>()
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user