[edge] Listeners, tests first: an overall header deadline (slowloris), pipelined requests answered in order on both listeners, a proxy socket whose X-Forwarded-For is believed (red: the deadline is a pass-through)

This commit is contained in:
2026-11-10 20:43:50 +01:00
parent 0e9c2a7bc9
commit 7a2aee20eb
7 changed files with 722 additions and 14 deletions
+24 -11
View File
@@ -13,6 +13,7 @@
pub mod acme;
#[cfg(unix)]
pub mod admin;
pub mod deadline;
pub mod error;
pub mod fetch;
pub mod forward_auth;
@@ -32,7 +33,7 @@ use std::sync::Arc;
use pingora::connectors::http::Connector;
use pingora::listeners::tls::TlsSettings;
use pingora::proxy::http_proxy_service;
use pingora::proxy::http_proxy;
use pingora::server::Server;
use pingora::server::configuration::ServerConf;
use pingora::services::background::background_service;
@@ -56,6 +57,8 @@ pub struct Options {
pub acme_root: Option<PathBuf>,
/// Overrides `$CREDENTIALS_DIRECTORY` (tests running several edges in one process).
pub credentials_dir: Option<PathBuf>,
/// The overall deadline for a request header; default [`deadline::HEADER_TIMEOUT`].
pub header_timeout: Option<std::time::Duration>,
}
impl Options {
@@ -114,12 +117,19 @@ pub fn server(shared: Arc<Shared>, opts: &Options) -> Result<Server, EdgeError>
let challenges = Arc::new(acme::Challenges::default());
let rt = shared.current();
let mut https = http_proxy_service(
&server.configuration,
proxy::EdgeProxy {
shared: shared.clone(),
connector: Connector::new(None),
},
let header_timeout = opts.header_timeout.unwrap_or(deadline::HEADER_TIMEOUT);
let mut https = Service::new(
"ianitor https".to_owned(),
deadline::HeaderDeadline::new(
http_proxy(
&server.configuration,
proxy::EdgeProxy {
shared: shared.clone(),
connector: Connector::new(None),
},
),
header_timeout,
),
);
let mut tls =
TlsSettings::with_callbacks(Box::new(tls::SniRecorder)).map_err(|e| EdgeError::Listen {
@@ -136,10 +146,13 @@ pub fn server(shared: Arc<Shared>, opts: &Options) -> Result<Server, EdgeError>
let mut http = Service::new(
"ianitor http".to_owned(),
http_app::HttpApp {
shared: shared.clone(),
challenges: challenges.clone(),
},
deadline::HeaderDeadline::new(
http_app::HttpApp {
shared: shared.clone(),
challenges: challenges.clone(),
},
header_timeout,
),
);
http.add_tcp(&rt.cfg.http_listen);