refactor(lib): resolve unused warnings from server-specific code (#2710)
This commit is contained in:
@@ -71,6 +71,7 @@ pub(super) enum Parse {
|
||||
#[cfg(feature = "http1")]
|
||||
VersionH2,
|
||||
Uri,
|
||||
#[cfg_attr(not(all(feature = "http1", feature = "server")), allow(unused))]
|
||||
UriTooLong,
|
||||
Header(Header),
|
||||
TooLarge,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use std::fmt;
|
||||
use std::io;
|
||||
use std::marker::PhantomData;
|
||||
#[cfg(all(feature = "server", feature = "runtime"))]
|
||||
use std::time::Duration;
|
||||
|
||||
use bytes::{Buf, Bytes};
|
||||
|
||||
@@ -3,6 +3,7 @@ use std::fmt;
|
||||
use std::io::{self, IoSlice};
|
||||
use std::marker::Unpin;
|
||||
use std::mem::MaybeUninit;
|
||||
#[cfg(all(feature = "server", feature = "runtime"))]
|
||||
use std::future::Future;
|
||||
#[cfg(all(feature = "server", feature = "runtime"))]
|
||||
use std::time::Duration;
|
||||
@@ -11,7 +12,7 @@ use std::time::Duration;
|
||||
use tokio::time::Instant;
|
||||
use bytes::{Buf, BufMut, Bytes, BytesMut};
|
||||
use tokio::io::{AsyncRead, AsyncWrite, ReadBuf};
|
||||
use tracing::{debug, warn, trace};
|
||||
use tracing::{debug, trace};
|
||||
|
||||
use super::{Http1Transaction, ParseContext, ParsedMessage};
|
||||
use crate::common::buf::BufList;
|
||||
@@ -227,7 +228,7 @@ where
|
||||
if Pin::new( h1_header_read_timeout_fut).poll(cx).is_ready() {
|
||||
*parse_ctx.h1_header_read_timeout_running = false;
|
||||
|
||||
warn!("read header from client timeout");
|
||||
tracing::warn!("read header from client timeout");
|
||||
return Poll::Ready(Err(crate::Error::new_header_timeout()))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use std::pin::Pin;
|
||||
use std::time::Duration;
|
||||
#[cfg(all(feature = "server", feature = "runtime"))]
|
||||
use std::{pin::Pin, time::Duration};
|
||||
|
||||
use bytes::BytesMut;
|
||||
use http::{HeaderMap, Method};
|
||||
|
||||
@@ -25,6 +25,7 @@ use crate::proto::{BodyLength, MessageHead, RequestHead, RequestLine};
|
||||
|
||||
const MAX_HEADERS: usize = 100;
|
||||
const AVERAGE_HEADER_SIZE: usize = 30; // totally scientific
|
||||
#[cfg(feature = "server")]
|
||||
const MAX_URI_LEN: usize = (u16::MAX - 1) as usize;
|
||||
|
||||
macro_rules! header_name {
|
||||
|
||||
Reference in New Issue
Block a user