Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ indexing_slicing = "allow"
match_wild_err_arm = "allow"
multiple_inherent_impl = "allow"
multiple_unsafe_ops_per_block = "allow"
needless_pass_by_value = "allow"
pattern_type_mismatch = "allow"
redundant_else = "allow"
struct_excessive_bools = "allow" # TODO: bogus lint?
Expand Down
8 changes: 4 additions & 4 deletions src/body/incoming.rs
Original file line number Diff line number Diff line change
Expand Up @@ -393,18 +393,18 @@ mod tests {
#[cfg(all(feature = "http1", any(feature = "client", feature = "server")))]
#[test]
fn size_hint() {
fn eq(body: Incoming, b: SizeHint, note: &str) {
fn eq(body: &Incoming, b: SizeHint, note: &str) {
let a = body.size_hint();
assert_eq!(a.lower(), b.lower(), "lower for {:?}", note);
assert_eq!(a.upper(), b.upper(), "upper for {:?}", note);
}

eq(Incoming::empty(), SizeHint::with_exact(0), "empty");
eq(&Incoming::empty(), SizeHint::with_exact(0), "empty");

eq(Incoming::channel().1, SizeHint::new(), "channel");
eq(&Incoming::channel().1, SizeHint::new(), "channel");

eq(
Incoming::new_channel(DecodedLength::new(4), /*wanter =*/ false).1,
&Incoming::new_channel(DecodedLength::new(4), /*wanter =*/ false).1,
SizeHint::with_exact(4),
"channel with length",
);
Expand Down
2 changes: 1 addition & 1 deletion src/proto/h1/conn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ where

let msg = match self.io.parse::<T>(
cx,
ParseContext {
&mut ParseContext {
cached_headers: &mut self.state.cached_headers,
req_method: &mut self.state.method,
h1_parser_config: self.state.h1_parser_config.clone(),
Expand Down
6 changes: 3 additions & 3 deletions src/proto/h1/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ where
pub(super) fn parse<S>(
&mut self,
cx: &mut Context<'_>,
parse_ctx: ParseContext<'_>,
parse_ctx: &mut ParseContext<'_>,
) -> Poll<crate::Result<ParsedMessage<S::Incoming>>>
where
S: Http1Transaction,
Expand Down Expand Up @@ -699,7 +699,7 @@ mod tests {
// We expect a `parse` to be not ready, and so can't await it directly.
// Rather, this `poll_fn` will wrap the `Poll` result.
futures_util::future::poll_fn(|cx| {
let parse_ctx = ParseContext {
let mut parse_ctx = ParseContext {
cached_headers: &mut None,
req_method: &mut None,
h1_parser_config: Default::default(),
Expand All @@ -713,7 +713,7 @@ mod tests {
on_informational: &mut None,
};
assert!(buffered
.parse::<ClientTransaction>(cx, parse_ctx)
.parse::<ClientTransaction>(cx, &mut parse_ctx)
.is_pending());
Poll::Ready(())
})
Expand Down
10 changes: 5 additions & 5 deletions src/proto/h1/role.rs
Original file line number Diff line number Diff line change
Expand Up @@ -476,15 +476,15 @@ impl Http1Transaction for Server {
};
let encoder = if let Some(orig_headers) = orig_headers {
Self::encode_headers_with_original_case(
msg,
&mut msg,
dst,
is_last,
orig_len,
wrote_len,
orig_headers,
)?
} else {
Self::encode_headers_with_lower_case(msg, dst, is_last, orig_len, wrote_len)?
Self::encode_headers_with_lower_case(&mut msg, dst, is_last, orig_len, wrote_len)?
};

ret.map(|()| encoder)
Expand Down Expand Up @@ -548,7 +548,7 @@ impl Server {
}

fn encode_headers_with_lower_case(
msg: Encode<'_, StatusCode>,
msg: &mut Encode<'_, StatusCode>,
dst: &mut Vec<u8>,
is_last: bool,
orig_len: usize,
Expand Down Expand Up @@ -589,7 +589,7 @@ impl Server {
#[cold]
#[inline(never)]
fn encode_headers_with_original_case(
msg: Encode<'_, StatusCode>,
msg: &mut Encode<'_, StatusCode>,
dst: &mut Vec<u8>,
is_last: bool,
orig_len: usize,
Expand Down Expand Up @@ -659,7 +659,7 @@ impl Server {

#[inline]
fn encode_headers<W>(
msg: Encode<'_, StatusCode>,
msg: &mut Encode<'_, StatusCode>,
dst: &mut Vec<u8>,
mut is_last: bool,
orig_len: usize,
Expand Down
7 changes: 5 additions & 2 deletions src/proto/h2/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ where

let (conn, ping) = if ping_config.is_enabled() {
let pp = conn.ping_pong().expect("conn.ping_pong");
let (recorder, ponger) = ping::channel(pp, ping_config, timer);
let (recorder, ponger) = ping::channel(pp, &ping_config, timer);

let conn: Conn<_, B> = Conn::new(ponger, conn);
(Either::left(conn), recorder)
Expand Down Expand Up @@ -706,7 +706,10 @@ where
}
let (head, body) = req.into_parts();
let mut req = ::http::Request::from_parts(head, ());
super::strip_connection_headers(req.headers_mut(), super::MessageKind::Request);
super::strip_connection_headers(
req.headers_mut(),
&super::MessageKind::Request,
);
if let Some(len) = body.size_hint().exact() {
if len != 0 || headers::method_has_defined_payload_semantics(req.method()) {
headers::set_content_length_if_missing(req.headers_mut(), len);
Expand Down
2 changes: 1 addition & 1 deletion src/proto/h2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ enum MessageKind {
Response,
}

fn strip_connection_headers(headers: &mut HeaderMap, kind: MessageKind) {
fn strip_connection_headers(headers: &mut HeaderMap, kind: &MessageKind) {
for header in &CONNECTION_HEADERS {
if headers.remove(header).is_some() {
warn!("Connection header illegal in HTTP/2: {}", header.as_str());
Expand Down
2 changes: 1 addition & 1 deletion src/proto/h2/ping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub(super) fn disabled() -> Recorder {
Recorder { shared: None }
}

pub(super) fn channel(ping_pong: PingPong, config: Config, timer: Time) -> (Recorder, Ponger) {
pub(super) fn channel(ping_pong: PingPong, config: &Config, timer: Time) -> (Recorder, Ponger) {
debug_assert!(
config.is_enabled(),
"ping channel requires bdp or keep-alive config",
Expand Down
4 changes: 2 additions & 2 deletions src/proto/h2/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ where
let mut conn = ready!(Pin::new(hs).poll(cx).map_err(crate::Error::new_h2))?;
let ping = if ping_config.is_enabled() {
let pp = conn.ping_pong().expect("conn.ping_pong");
Some(ping::channel(pp, ping_config.clone(), me.timer.clone()))
Some(ping::channel(pp, ping_config, me.timer.clone()))
} else {
None
};
Expand Down Expand Up @@ -471,7 +471,7 @@ where
let mut res = ::http::Response::from_parts(head, ());
super::strip_connection_headers(
res.headers_mut(),
super::MessageKind::Response,
&super::MessageKind::Response,
);

// set Date header if it isn't already set if instructed
Expand Down
Loading