Skip to content

Commit

Permalink
feat(client): remove unneeded HTTP/1 executor (#3108)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: The method
  `hyper::client::conn::http1::Builder::executor()` is removed, since it did nothing.
  • Loading branch information
bossmc authored Jan 4, 2023
1 parent bb609b2 commit 1de9acc
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 18 deletions.
14 changes: 0 additions & 14 deletions src/client/conn/http1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

use std::error::Error as StdError;
use std::fmt;
use std::sync::Arc;

use bytes::Bytes;
use http::{Request, Response};
Expand All @@ -12,11 +11,9 @@ use tokio::io::{AsyncRead, AsyncWrite};
use super::super::dispatch;
use crate::body::{Body, Incoming as IncomingBody};
use crate::common::{
exec::{BoxSendFuture, Exec},
task, Future, Pin, Poll,
};
use crate::proto;
use crate::rt::Executor;
use crate::upgrade::Upgraded;

type Dispatcher<T, B> =
Expand Down Expand Up @@ -102,7 +99,6 @@ where
/// After setting options, the builder is used to create a handshake future.
#[derive(Clone, Debug)]
pub struct Builder {
pub(super) exec: Exec,
h09_responses: bool,
h1_parser_config: ParserConfig,
h1_writev: Option<bool>,
Expand Down Expand Up @@ -289,7 +285,6 @@ impl Builder {
#[inline]
pub fn new() -> Builder {
Builder {
exec: Exec::Default,
h09_responses: false,
h1_writev: None,
h1_read_buf_exact_size: None,
Expand All @@ -302,15 +297,6 @@ impl Builder {
}
}

/// Provide an executor to execute background HTTP1 tasks.
pub fn executor<E>(&mut self, exec: E) -> &mut Builder
where
E: Executor<BoxSendFuture> + Send + Sync + 'static,
{
self.exec = Exec::Executor(Arc::new(exec));
self
}

/// Set whether HTTP/0.9 responses should be tolerated.
///
/// Default is false.
Expand Down
3 changes: 1 addition & 2 deletions src/ffi/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,10 @@ ffi_fn! {
}));
hyper_clientconn { tx: Tx::Http2(tx) }
});
}
}
}

conn::http1::Builder::new()
.executor(options.exec.clone())
.allow_obsolete_multiline_headers_in_responses(options.http1_allow_obsolete_multiline_headers_in_responses)
.preserve_header_case(options.http1_preserve_header_case)
.preserve_header_order(options.http1_preserve_header_order)
Expand Down
2 changes: 1 addition & 1 deletion src/server/conn/http1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pin_project_lite::pin_project! {
/// A configuration builder for HTTP/1 server connections.
#[derive(Clone, Debug)]
pub struct Builder {
pub(crate) timer: Time,
timer: Time,
h1_half_close: bool,
h1_keep_alive: bool,
h1_title_case_headers: bool,
Expand Down
1 change: 0 additions & 1 deletion tests/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3029,7 +3029,6 @@ impl TestClient {
sender.send_request(req).await
} else {
let (mut sender, conn) = hyper::client::conn::http1::Builder::new()
.executor(TokioExecutor)
.handshake(stream)
.await
.unwrap();
Expand Down

0 comments on commit 1de9acc

Please sign in to comment.