mirror of https://github.com/rwf2/Rocket.git
Use unboxed WrappedStream.
This commit is contained in:
parent
0a8de2f0a6
commit
45eb475607
|
@ -3,7 +3,7 @@ use std::path::Path;
|
|||
use std::fs::File;
|
||||
use std::time::Duration;
|
||||
|
||||
#[cfg(feature = "tls")] use hyper_rustls::WrappedStream;
|
||||
#[cfg(feature = "tls")] use super::net_stream::HttpsStream;
|
||||
|
||||
use super::data_stream::DataStream;
|
||||
use super::net_stream::NetStream;
|
||||
|
@ -82,7 +82,7 @@ impl Data {
|
|||
|
||||
#[cfg(feature = "tls")]
|
||||
fn concrete_stream(stream: &&mut NetworkStream) -> Option<NetStream> {
|
||||
stream.downcast_ref::<WrappedStream>()
|
||||
stream.downcast_ref::<HttpsStream>()
|
||||
.map(|s| NetStream::Https(s.clone()))
|
||||
.or_else(|| {
|
||||
stream.downcast_ref::<HttpStream>()
|
||||
|
|
|
@ -2,18 +2,20 @@ use std::io::{self, Cursor};
|
|||
use std::net::{SocketAddr, Shutdown};
|
||||
use std::time::Duration;
|
||||
|
||||
#[cfg(feature = "tls")] use hyper_rustls::WrappedStream as RustlsStream;
|
||||
#[cfg(feature = "tls")] use hyper_rustls::{WrappedStream, ServerSession};
|
||||
use http::hyper::net::{HttpStream, NetworkStream};
|
||||
|
||||
use self::NetStream::*;
|
||||
|
||||
#[cfg(feature = "tls")] pub type HttpsStream = WrappedStream<ServerSession>;
|
||||
|
||||
// This is a representation of all of the possible network streams we might get.
|
||||
// This really shouldn't be necessary, but, you know, Hyper.
|
||||
#[derive(Clone)]
|
||||
pub enum NetStream {
|
||||
Http(HttpStream),
|
||||
#[cfg(feature = "tls")]
|
||||
Https(RustlsStream),
|
||||
Https(HttpsStream),
|
||||
Local(Cursor<Vec<u8>>)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue