mirror of
https://github.com/YGGverse/ggemini.git
synced 2026-03-31 17:15:31 +00:00
update session update detection
This commit is contained in:
parent
b3e9bf239c
commit
c3a76472d2
1 changed files with 26 additions and 10 deletions
|
|
@ -80,6 +80,7 @@ impl Client {
|
||||||
|
|
||||||
// Update previous session available for this request
|
// Update previous session available for this request
|
||||||
match self.update_session(&uri, certificate.as_ref()) {
|
match self.update_session(&uri, certificate.as_ref()) {
|
||||||
|
// Begin new connection
|
||||||
Ok(()) => match crate::gio::network_address::from_uri(&uri, crate::DEFAULT_PORT) {
|
Ok(()) => match crate::gio::network_address::from_uri(&uri, crate::DEFAULT_PORT) {
|
||||||
Ok(network_address) => self.socket.connect_async(
|
Ok(network_address) => self.socket.connect_async(
|
||||||
&network_address.clone(),
|
&network_address.clone(),
|
||||||
|
|
@ -101,7 +102,7 @@ impl Client {
|
||||||
// Wrap connection to shared reference clone semantics
|
// Wrap connection to shared reference clone semantics
|
||||||
let connection = Rc::new(connection);
|
let connection = Rc::new(connection);
|
||||||
|
|
||||||
// Update session record
|
// Update session
|
||||||
session.update(uri.to_string(), connection.clone());
|
session.update(uri.to_string(), connection.clone());
|
||||||
|
|
||||||
// Begin new request
|
// Begin new request
|
||||||
|
|
@ -140,16 +141,31 @@ impl Client {
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
if let Some(connection) = self.session.get(&uri.to_string()) {
|
if let Some(connection) = self.session.get(&uri.to_string()) {
|
||||||
// Check connection contain TLS authorization
|
// Check connection contain TLS authorization
|
||||||
if let Some(ref tls_client_connection) = connection.tls_client_connection {
|
match connection.tls_client_connection {
|
||||||
if let Some(new) = certificate {
|
Some(ref tls_client_connection) => {
|
||||||
// Get previous certificate
|
match certificate {
|
||||||
if let Some(ref old) = tls_client_connection.certificate() {
|
Some(new) => {
|
||||||
if !new.is_same(old) {
|
// Get previous certificate
|
||||||
// Prevent session resumption
|
if let Some(ref old) = tls_client_connection.certificate() {
|
||||||
// Glib backend restore session in runtime with old certificate
|
// User -> User
|
||||||
// @TODO keep in mind, until better solution found for TLS 1.3
|
if !new.is_same(old) {
|
||||||
println!("{:?}", tls_client_connection.handshake(Cancellable::NONE));
|
// Prevent session resumption
|
||||||
|
// Glib backend restore session in runtime with old certificate
|
||||||
|
// @TODO keep in mind, until better solution found for TLS 1.3
|
||||||
|
println!("{:?}", connection.rehandshake());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
None => {
|
||||||
|
// User -> Guest
|
||||||
|
println!("{:?}", connection.rehandshake());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
None => {
|
||||||
|
// Guest -> User
|
||||||
|
if certificate.is_some() {
|
||||||
|
println!("{:?}", connection.rehandshake());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue