1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-08-31 08:57:00 +02:00

add H1 transport

This commit is contained in:
Nikolay Kim
2018-10-02 17:30:29 -07:00
parent ae5c4dfb78
commit 2710f70e39
11 changed files with 284 additions and 74 deletions

View File

@@ -106,7 +106,7 @@
//! let _ = sys.run();
//!}
//! ```
use std::net::Shutdown;
use std::net::{Shutdown, SocketAddr};
use std::rc::Rc;
use std::{io, time};
@@ -143,10 +143,13 @@ pub use self::message::Request;
pub use self::ssl::*;
pub use self::error::{AcceptorError, HttpDispatchError};
pub use self::settings::{ServerSettings, ServiceConfig, ServiceConfigBuilder};
pub use self::settings::ServerSettings;
#[doc(hidden)]
pub use self::service::{HttpService, StreamConfiguration};
pub use self::settings::{ServiceConfig, ServiceConfigBuilder};
#[doc(hidden)]
pub use self::service::{H1Service, HttpService, StreamConfiguration};
#[doc(hidden)]
pub use self::helpers::write_content_length;
@@ -266,6 +269,12 @@ pub trait Writer {
pub trait IoStream: AsyncRead + AsyncWrite + 'static {
fn shutdown(&mut self, how: Shutdown) -> io::Result<()>;
/// Returns the socket address of the remote peer of this TCP connection.
fn peer_addr(&self) -> Option<SocketAddr> {
None
}
/// Sets the value of the TCP_NODELAY option on this socket.
fn set_nodelay(&mut self, nodelay: bool) -> io::Result<()>;
fn set_linger(&mut self, dur: Option<time::Duration>) -> io::Result<()>;
@@ -341,6 +350,11 @@ impl IoStream for TcpStream {
TcpStream::shutdown(self, how)
}
#[inline]
fn peer_addr(&self) -> Option<SocketAddr> {
TcpStream::peer_addr(self).ok()
}
#[inline]
fn set_nodelay(&mut self, nodelay: bool) -> io::Result<()> {
TcpStream::set_nodelay(self, nodelay)