diff --git a/hyper/src/client/client.rs b/hyper/src/client/client.rs index 281b5fb..ae8fa4d 100644 --- a/hyper/src/client/client.rs +++ b/hyper/src/client/client.rs @@ -3,22 +3,22 @@ use std::fmt; use std::time::Duration; -use futures_util::future::{self, Either, FutureExt as _, TryFutureExt as _}; +use futures_util::future::{Either}; use super::conn; -use super::connect::{self, sealed::Connect, Alpn, Connected, Connection}; -use super::pool::{self, Key as PoolKey, Pool, Poolable, Pooled, Reservation}; +use super::connect::{sealed::Connect, Connected}; +use super::pool::{self, Key as PoolKey, Pool, Poolable, Reservation}; #[cfg(feature = "tcp")] use super::HttpConnector; use crate::body::{Body, HttpBody}; use crate::common::{ - exec::BoxSendFuture, lazy as hyper_lazy, sync_wrapper::SyncWrapper, task, Future, Lazy, Pin, + exec::BoxSendFuture, sync_wrapper::SyncWrapper, task, Future, Pin, Poll, }; use crate::rt::Executor; use http::uri::{Port, Scheme}; use http::{Request, Response, Uri, Version}; -use tracing::{debug, trace}; + #[cfg_attr(docsrs, doc(cfg(any(feature = "http1", feature = "http2"))))] pub struct Client { diff --git a/hyper/src/common/exec.rs b/hyper/src/common/exec.rs index c65734d..799f29a 100644 --- a/hyper/src/common/exec.rs +++ b/hyper/src/common/exec.rs @@ -1,5 +1,4 @@ -#[cfg(all(feature = "server", any(feature = "http1", feature = "http2")))] -use crate::body::Body; + #[cfg(feature = "server")] use crate::body::HttpBody; #[cfg(all(feature = "http2", feature = "server"))] diff --git a/hyper/src/error.rs b/hyper/src/error.rs index 1c7c9cb..7074217 100644 --- a/hyper/src/error.rs +++ b/hyper/src/error.rs @@ -16,42 +16,42 @@ struct ErrorImpl { pub(super) enum Kind { Parse(Parse), User(User), - + #[allow(unused)] IncompleteMessage, - + #[cfg(feature = "http1")] UnexpectedMessage, - + Canceled, - + ChannelClosed, - + #[cfg(any(feature = "http1", feature = "http2"))] Io, - + #[allow(unused)] Connect, - + #[cfg(all(feature = "tcp", feature = "server"))] Listen, - + #[cfg(any(feature = "http1", feature = "http2"))] #[cfg(feature = "server")] Accept, - + #[cfg(all(feature = "http1", feature = "server", feature = "runtime"))] HeaderTimeout, - + #[cfg(any(feature = "http1", feature = "http2", feature = "stream"))] Body, - + #[cfg(any(feature = "http1", feature = "http2"))] BodyWrite, - + #[cfg(feature = "http1")] Shutdown, - + #[cfg(feature = "http2")] Http2, } @@ -82,100 +82,95 @@ pub(super) enum Header { } #[derive(Debug)] pub(super) enum User { - #[cfg(any(feature = "http1", feature = "http2"))] Body, - + BodyWriteAborted, - + #[cfg(any(feature = "http1", feature = "http2"))] #[cfg(feature = "server")] MakeService, - + #[cfg(any(feature = "http1", feature = "http2"))] Service, - - - + #[cfg(any(feature = "http1", feature = "http2"))] #[cfg(feature = "server")] UnexpectedHeader, - + #[cfg(any(feature = "http1", feature = "http2"))] #[cfg(feature = "client")] UnsupportedVersion, - + #[cfg(any(feature = "http1", feature = "http2"))] #[cfg(feature = "client")] UnsupportedRequestMethod, - + #[cfg(feature = "http1")] #[cfg(feature = "server")] UnsupportedStatusCode, - + #[cfg(any(feature = "http1", feature = "http2"))] #[cfg(feature = "client")] AbsoluteUriRequired, - + NoUpgrade, - + #[cfg(feature = "http1")] ManualUpgrade, - + #[cfg(feature = "server")] WithoutShutdownNonHttp1, - + #[cfg(feature = "client")] DispatchGone, - + #[cfg(feature = "ffi")] AbortedByCallback, } #[derive(Debug)] pub(super) struct TimedOut; impl Error { - pub(crate) fn is_parse(&self) -> bool { loop {} } - + pub(crate) fn is_parse_too_large(&self) -> bool { loop {} } - - + pub(crate) fn is_parse_status(&self) -> bool { loop {} } - + pub(crate) fn is_user(&self) -> bool { loop {} } - + pub(crate) fn is_canceled(&self) -> bool { loop {} } - + pub(crate) fn is_closed(&self) -> bool { loop {} } - + pub(crate) fn is_connect(&self) -> bool { loop {} } - + pub(crate) fn is_incomplete_message(&self) -> bool { loop {} } - + pub(crate) fn is_body_write_aborted(&self) -> bool { loop {} } - + pub(crate) fn is_timeout(&self) -> bool { loop {} } - + pub(crate) fn into_cause(self) -> Option> { loop {} } @@ -319,7 +314,7 @@ impl Error { pub(super) fn new_h2(cause: ::h2::Error) -> Error { loop {} } - + pub(crate) fn message(&self) -> impl fmt::Display + '_ { self.description() } diff --git a/hyper/src/ext.rs b/hyper/src/ext.rs index b7febdf..2e360aa 100644 --- a/hyper/src/ext.rs +++ b/hyper/src/ext.rs @@ -13,21 +13,16 @@ use std::fmt; mod h1_reason_phrase; #[cfg(feature = "http2")] - - - - #[derive(Clone, Eq, PartialEq)] pub(crate) struct Protocol { inner: h2::ext::Protocol, } #[cfg(feature = "http2")] impl Protocol { - pub(crate) const fn from_static(value: &'static str) -> Self { loop {} } - + pub(crate) fn as_str(&self) -> &str { loop {} } @@ -57,45 +52,19 @@ impl fmt::Debug for Protocol { loop {} } } - - - - - - - - - - - - - - - - - - - - #[derive(Clone, Debug)] pub(crate) struct HeaderCaseMap(HeaderMap); #[cfg(feature = "http1")] impl HeaderCaseMap { - - pub(crate) fn get_all<'a>( &'a self, name: &HeaderName, ) -> impl Iterator + 'a> + 'a { self.get_all_internal(name).into_iter() } - - - pub(crate) fn get_all_internal<'a>( - &'a self, - name: &HeaderName, - ) -> ValueIter<'_, Bytes> { + + pub(crate) fn get_all_internal<'a>(&'a self, name: &HeaderName) -> ValueIter<'_, Bytes> { loop {} } pub(crate) fn default() -> Self { @@ -116,14 +85,8 @@ impl HeaderCaseMap { #[derive(Clone, Debug)] pub(crate) struct OriginalHeaderOrder { - - num_entries: HashMap, - - - - - + entry_order: Vec<(HeaderName, usize)>, } #[cfg(all(feature = "http1", feature = "ffi"))] @@ -140,43 +103,7 @@ impl OriginalHeaderOrder { { loop {} } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + pub(crate) fn get_in_order(&self) -> impl Iterator { loop {} } diff --git a/hyper/src/ext/h1_reason_phrase.rs b/hyper/src/ext/h1_reason_phrase.rs index 5e1e5a6..139597f 100644 --- a/hyper/src/ext/h1_reason_phrase.rs +++ b/hyper/src/ext/h1_reason_phrase.rs @@ -1,2 +1,2 @@ -use std::convert::TryFrom; -use bytes::Bytes; + + diff --git a/hyper/src/headers.rs b/hyper/src/headers.rs index 45a6df4..557f225 100644 --- a/hyper/src/headers.rs +++ b/hyper/src/headers.rs @@ -1,57 +1,4 @@ - - use http::header::{HeaderValue, ValueIter}; use http::HeaderMap; #[cfg(all(feature = "http2", feature = "client"))] use http::Method; -#[cfg(feature = "http1")] -pub(super) fn connection_keep_alive(value: &HeaderValue) -> bool { - loop {} -} -#[cfg(feature = "http1")] -pub(super) fn connection_close(value: &HeaderValue) -> bool { - loop {} -} -#[cfg(feature = "http1")] -fn connection_has(value: &HeaderValue, needle: &str) -> bool { - loop {} -} -#[cfg(all(feature = "http1", feature = "server"))] -pub(super) fn content_length_parse(value: &HeaderValue) -> Option { - loop {} -} -pub(super) fn content_length_parse_all(headers: &HeaderMap) -> Option { - loop {} -} -pub(super) fn content_length_parse_all_values( - values: ValueIter<'_, HeaderValue>, -) -> Option { - loop {} -} -fn from_digits(bytes: &[u8]) -> Option { - loop {} -} -#[cfg(all(feature = "http2", feature = "client"))] -pub(super) fn method_has_defined_payload_semantics(method: &Method) -> bool { - loop {} -} -#[cfg(feature = "http2")] -pub(super) fn set_content_length_if_missing(headers: &mut HeaderMap, len: u64) { - loop {} -} -#[cfg(feature = "http1")] -pub(super) fn transfer_encoding_is_chunked(headers: &HeaderMap) -> bool { - loop {} -} -#[cfg(feature = "http1")] -pub(super) fn is_chunked(mut encodings: ValueIter<'_, HeaderValue>) -> bool { - loop {} -} -#[cfg(feature = "http1")] -pub(super) fn is_chunked_(value: &HeaderValue) -> bool { - loop {} -} -#[cfg(feature = "http1")] -pub(super) fn add_chunked(mut entry: http::header::OccupiedEntry<'_, HeaderValue>) { - loop {} -} diff --git a/hyper/src/server/server.rs b/hyper/src/server/server.rs index 9eb7119..5bf86b1 100644 --- a/hyper/src/server/server.rs +++ b/hyper/src/server/server.rs @@ -3,15 +3,14 @@ use super::accept::Accept; use super::conn::Http as Http_; #[cfg(all(feature = "tcp"))] use super::tcp::AddrIncoming; -use crate::body::{Body, HttpBody}; +use crate::body::{Body}; use crate::common::exec::Exec; -use crate::common::exec::{ConnStreamExec, NewSvcExec}; -use crate::common::{task, Future, Pin, Poll, Unpin}; +use crate::common::exec::{NewSvcExec}; +use crate::common::{task, Future, Pin, Poll}; use crate::service::{HttpService, MakeServiceRef}; use pin_project_lite::pin_project; use std::error::Error as StdError; -#[cfg(feature = "tcp")] -use tokio::io::{AsyncRead, AsyncWrite}; + pub struct Server { incoming: I, make_service: S, @@ -91,7 +90,7 @@ where } pub(crate) mod new_svc { use super::Watcher; - use crate::body::{Body, HttpBody}; + use crate::body::{Body}; use crate::common::exec::ConnStreamExec; use crate::common::{task, Future, Pin, Poll}; use crate::service::HttpService; diff --git a/hyper/src/server/tcp.rs b/hyper/src/server/tcp.rs index 3f66ac8..29a2c86 100644 --- a/hyper/src/server/tcp.rs +++ b/hyper/src/server/tcp.rs @@ -1,14 +1,14 @@ use std::fmt; use std::io; -use std::net::{SocketAddr, TcpListener as StdTcpListener}; +use std::net::SocketAddr; use std::time::Duration; -use socket2::TcpKeepalive; -use tokio::net::TcpListener; -use tokio::time::Sleep; -use crate::common::{task, Pin, Poll}; + #[allow(unreachable_pub)] pub use self::addr_stream::AddrStream; use super::accept::Accept; +use crate::common::{task, Pin, Poll}; +use tokio::net::TcpListener; +use tokio::time::Sleep; #[derive(Default, Debug, Clone, Copy)] struct TcpKeepaliveConfig { time: Option, @@ -16,62 +16,46 @@ struct TcpKeepaliveConfig { retries: Option, } impl TcpKeepaliveConfig { - #[cfg( - not( - any( - target_os = "android", - target_os = "dragonfly", - target_os = "freebsd", - target_os = "fuchsia", - target_os = "illumos", - target_os = "linux", - target_os = "netbsd", - target_vendor = "apple", - windows, - ) - ) - )] + #[cfg(not(any( + target_os = "android", + target_os = "dragonfly", + target_os = "freebsd", + target_os = "fuchsia", + target_os = "illumos", + target_os = "linux", + target_os = "netbsd", + target_vendor = "apple", + windows, + )))] fn ka_with_interval(ka: TcpKeepalive, _: Duration, _: &mut bool) -> TcpKeepalive { loop {} } - #[cfg( - not( - any( - target_os = "android", - target_os = "dragonfly", - target_os = "freebsd", - target_os = "fuchsia", - target_os = "illumos", - target_os = "linux", - target_os = "netbsd", - target_vendor = "apple", - ) - ) - )] + #[cfg(not(any( + target_os = "android", + target_os = "dragonfly", + target_os = "freebsd", + target_os = "fuchsia", + target_os = "illumos", + target_os = "linux", + target_os = "netbsd", + target_vendor = "apple", + )))] fn ka_with_retries(ka: TcpKeepalive, _: u32, _: &mut bool) -> TcpKeepalive { loop {} } } #[must_use = "streams do nothing unless polled"] -pub struct AddrIncoming { - addr: SocketAddr, - listener: TcpListener, - sleep_on_errors: bool, - tcp_keepalive_config: TcpKeepaliveConfig, - tcp_nodelay: bool, - timeout: Option>>, -} +pub struct AddrIncoming {} impl AddrIncoming { - pub fn bind(addr: &SocketAddr) -> crate::Result { loop {} } - + pub fn local_addr(&self) -> SocketAddr { loop {} } - + pub fn set_nodelay(&mut self, enabled: bool) -> &mut Self { loop {} } @@ -92,13 +76,13 @@ impl fmt::Debug for AddrIncoming { } } mod addr_stream { + use crate::common::{task, Pin, Poll}; use std::io; use std::net::SocketAddr; #[cfg(unix)] use std::os::unix::io::{AsRawFd, RawFd}; use tokio::io::{AsyncRead, AsyncWrite, ReadBuf}; use tokio::net::TcpStream; - use crate::common::{task, Pin, Poll}; pin_project_lite::pin_project! { #[doc = " A transport returned yieled by `AddrIncoming`."] #[derive(Debug)] pub struct AddrStream { #[pin] inner : TcpStream, pub (super) remote_addr : @@ -133,17 +117,11 @@ mod addr_stream { loop {} } #[inline] - fn poll_flush( - self: Pin<&mut Self>, - _cx: &mut task::Context<'_>, - ) -> Poll> { + fn poll_flush(self: Pin<&mut Self>, _cx: &mut task::Context<'_>) -> Poll> { loop {} } #[inline] - fn poll_shutdown( - self: Pin<&mut Self>, - cx: &mut task::Context<'_>, - ) -> Poll> { + fn poll_shutdown(self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> Poll> { loop {} } #[inline] diff --git a/hyper/src/service/util.rs b/hyper/src/service/util.rs index 82020a5..9dea784 100644 --- a/hyper/src/service/util.rs +++ b/hyper/src/service/util.rs @@ -1,26 +1,9 @@ -use std::error::Error as StdError; -use std::fmt; -use std::marker::PhantomData; use crate::body::HttpBody; use crate::common::{task, Future, Poll}; use crate::{Request, Response}; - - - - - - - - - - - - - - - - - +use std::error::Error as StdError; +use std::fmt; +use std::marker::PhantomData; pub fn service_fn(f: F) -> ServiceFn where @@ -35,7 +18,7 @@ pub struct ServiceFn { _req: PhantomData, } impl tower_service::Service> -for ServiceFn + for ServiceFn where F: FnMut(Request) -> Ret, ReqBody: HttpBody, @@ -46,10 +29,7 @@ where type Response = crate::Response; type Error = E; type Future = Ret; - fn poll_ready( - &mut self, - _cx: &mut task::Context<'_>, - ) -> Poll> { + fn poll_ready(&mut self, _cx: &mut task::Context<'_>) -> Poll> { loop {} } fn call(&mut self, req: Request) -> Self::Future { @@ -69,7 +49,4 @@ where loop {} } } -impl Copy for ServiceFn -where - F: Copy, -{} +impl Copy for ServiceFn where F: Copy {}