mirror of
https://github.com/fafhrd91/actix-web
synced 2024-11-24 08:22:59 +01:00
update openssl support
This commit is contained in:
parent
9f1417af30
commit
b6a1cfa6ad
@ -98,6 +98,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// This trait indicates types that can create acceptor service for http server.
|
||||||
pub trait AcceptorServiceFactory: Send + Clone + 'static {
|
pub trait AcceptorServiceFactory: Send + Clone + 'static {
|
||||||
type Io: IoStream + Send;
|
type Io: IoStream + Send;
|
||||||
type NewService: NewService<
|
type NewService: NewService<
|
||||||
@ -217,6 +218,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
|
/// Default acceptor service convert `TcpStream` to a `tokio_tcp::TcpStream`
|
||||||
pub(crate) struct DefaultAcceptor;
|
pub(crate) struct DefaultAcceptor;
|
||||||
|
|
||||||
impl AcceptorServiceFactory for DefaultAcceptor {
|
impl AcceptorServiceFactory for DefaultAcceptor {
|
||||||
|
@ -513,9 +513,7 @@ mod tests {
|
|||||||
use std::{cmp, io, time};
|
use std::{cmp, io, time};
|
||||||
|
|
||||||
use bytes::{Buf, Bytes, BytesMut};
|
use bytes::{Buf, Bytes, BytesMut};
|
||||||
use futures::future;
|
|
||||||
use http::{Method, Version};
|
use http::{Method, Version};
|
||||||
use tokio::runtime::current_thread;
|
|
||||||
use tokio_io::{AsyncRead, AsyncWrite};
|
use tokio_io::{AsyncRead, AsyncWrite};
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
@ -268,6 +268,7 @@ where
|
|||||||
mut self, lst: net::TcpListener, builder: SslAcceptorBuilder,
|
mut self, lst: net::TcpListener, builder: SslAcceptorBuilder,
|
||||||
) -> io::Result<Self> {
|
) -> io::Result<Self> {
|
||||||
use super::{openssl_acceptor_with_flags, ServerFlags};
|
use super::{openssl_acceptor_with_flags, ServerFlags};
|
||||||
|
use actix_net::service::NewServiceExt;
|
||||||
|
|
||||||
let flags = if self.no_http2 {
|
let flags = if self.no_http2 {
|
||||||
ServerFlags::HTTP1
|
ServerFlags::HTTP1
|
||||||
@ -283,6 +284,7 @@ where
|
|||||||
addr,
|
addr,
|
||||||
scheme: "https",
|
scheme: "https",
|
||||||
handler: Box::new(HttpServiceBuilder::new(
|
handler: Box::new(HttpServiceBuilder::new(
|
||||||
|
self.factory.clone(),
|
||||||
move || ssl::OpensslAcceptor::new(acceptor.clone()).map_err(|_| ()),
|
move || ssl::OpensslAcceptor::new(acceptor.clone()).map_err(|_| ()),
|
||||||
DefaultPipelineFactory::new(
|
DefaultPipelineFactory::new(
|
||||||
self.factory.clone(),
|
self.factory.clone(),
|
||||||
@ -411,6 +413,7 @@ where
|
|||||||
S: net::ToSocketAddrs,
|
S: net::ToSocketAddrs,
|
||||||
{
|
{
|
||||||
use super::{openssl_acceptor_with_flags, ServerFlags};
|
use super::{openssl_acceptor_with_flags, ServerFlags};
|
||||||
|
use actix_net::service::NewServiceExt;
|
||||||
|
|
||||||
let sockets = self.bind2(addr)?;
|
let sockets = self.bind2(addr)?;
|
||||||
|
|
||||||
@ -431,6 +434,7 @@ where
|
|||||||
addr,
|
addr,
|
||||||
scheme: "https",
|
scheme: "https",
|
||||||
handler: Box::new(HttpServiceBuilder::new(
|
handler: Box::new(HttpServiceBuilder::new(
|
||||||
|
self.factory.clone(),
|
||||||
move || ssl::OpensslAcceptor::new(accpt.clone()).map_err(|_| ()),
|
move || ssl::OpensslAcceptor::new(accpt.clone()).map_err(|_| ()),
|
||||||
DefaultPipelineFactory::new(
|
DefaultPipelineFactory::new(
|
||||||
self.factory.clone(),
|
self.factory.clone(),
|
||||||
|
Loading…
Reference in New Issue
Block a user