From 1feec707c1038fc138ba27a122cd204901f91661 Mon Sep 17 00:00:00 2001 From: IAmTomahawkx Date: Wed, 6 May 2026 18:01:44 -0700 Subject: [PATCH] fix: reimplement max redirects --- crates/services/january/src/requests.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crates/services/january/src/requests.rs b/crates/services/january/src/requests.rs index c73ed960..1dd0fc1f 100644 --- a/crates/services/january/src/requests.rs +++ b/crates/services/january/src/requests.rs @@ -266,6 +266,7 @@ impl Request { let url_host_str = url.host_str().ok_or(create_error!(ProxyError))?.to_string(); Request::url_is_blacklisted(&url).await?; + let mut redirect_count = 0; loop { let response = CLIENT @@ -284,6 +285,11 @@ impl Request { .map_err(|_| create_error!(ProxyError))?; if response.status().is_redirection() { + redirect_count += 1; + + if redirect_count > 5 { + return Err(create_error!(ProxyError)); + } if let Some(location) = response.headers().get("location") { let location = location.to_str().map_err(|_| create_error!(ProxyError))?; url = Url::from_str(location).to_internal_error()?;