|
/// let acceptor = tokio_rustls::LazyConfigAcceptor::new(rustls::server::Acceptor::default(), stream); |
|
/// tokio::pin!(acceptor); |
|
/// |
|
/// match acceptor.as_mut().await { |
|
/// Ok(start) => { |
|
/// let clientHello = start.client_hello(); |
|
/// let config = choose_server_config(clientHello); |
|
/// let stream = start.into_stream(config).await.unwrap(); |
|
/// // Proceed with handling the ServerConnection... |
|
/// } |
|
/// Err(err) => { |
|
/// if let Some(mut stream) = acceptor.take_io() { |
|
/// stream |
|
/// .write_all( |
|
/// format!("HTTP/1.1 400 Invalid Input\r\n\r\n\r\n{:?}\n", err) |
|
/// .as_bytes() |
|
/// ) |
|
/// .await |
|
/// .unwrap(); |
|
/// } |
|
/// } |
|
/// } |
|
/// # } |
shows an example of using take_io to write to the socket after a handshake fails. However, this stopped working in
0587801 which started sending alerts on the socket before returning.
There is seemingly some discussion on whether this should or shouldn't be possible in the library (#54) but probably we should remove the example if its intended to send alerts here (which does seem like reasonable behavior)
tokio-rustls/src/server.rs
Lines 106 to 128 in 7ac70c1
There is seemingly some discussion on whether this should or shouldn't be possible in the library (#54) but probably we should remove the example if its intended to send alerts here (which does seem like reasonable behavior)