mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-01-30 13: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>,
|
certificate: Option<TlsCertificate>,
|
||||||
) -> impl IsA<IOStream> {
|
) -> impl IsA<IOStream> {
|
||||||
if let Some(certificate) = certificate {
|
if let Some(certificate) = certificate {
|
||||||
|
// https://geminiprotocol.net/docs/protocol-specification.gmi#the-use-of-tls
|
||||||
let tls_connection =
|
let tls_connection =
|
||||||
TlsClientConnection::new(&connection, Some(&connectable)).unwrap(); // @TODO handle
|
TlsClientConnection::new(&connection, Some(&connectable)).unwrap(); // @TODO handle
|
||||||
|
|
||||||
|
// https://geminiprotocol.net/docs/protocol-specification.gmi#client-certificates
|
||||||
tls_connection.set_certificate(&certificate);
|
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
|
// @TODO manual validation
|
||||||
// https://geminiprotocol.net/docs/protocol-specification.gmi#tls-server-certificate-validation
|
// https://geminiprotocol.net/docs/protocol-specification.gmi#tls-server-certificate-validation
|
||||||
tls_connection.connect_accept_certificate(move |_, _, _| true);
|
tls_connection.connect_accept_certificate(move |_, _, _| true);
|
||||||
|
|
||||||
|
// Take encrypted I/O stream
|
||||||
tls_connection.upcast::<IOStream>()
|
tls_connection.upcast::<IOStream>()
|
||||||
} else {
|
} else {
|
||||||
|
// Take default I/O stream
|
||||||
connection.upcast::<IOStream>()
|
connection.upcast::<IOStream>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user