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