Import upstream v0.16.24, stripped

Upstream commit: af37a234981722493b74623a983581691d2b70b6
Enterprise-only files removed or emptied: 63
Enterprise-only snippets removed: 118 in 50 files
Dangling module declarations removed: 5
Edits turning enterprise off: 25
Third-party code: 14 files, 0 not in THIRD-PARTY.md
Renamed identifiers: 62 in 18 files
Verification: clean

The same Enterprise footprint as v0.16.23. The build check fails only on
tests/src/directory/issuer.rs, unchanged since v0.16.23: it calls a helper
from upstream's Enterprise-only OIDC test, and tests issuer-based directory
routing, an Enterprise feature. main has never carried it.
This commit is contained in:
2026-09-28 06:29:38 -07:00
parent 3a272096c0
commit f59b084ce5
98 changed files with 2851 additions and 1068 deletions
+28 -2
View File
@@ -203,7 +203,7 @@ impl SpamFilterAnalyzeUrl for Server {
if !ctx.result.has_tag("URL_REDIRECTOR_NESTED") {
let mut redirect_count = 1;
let mut url_redirect = Cow::Borrowed(url.element.url.as_str());
let mut url_redirect = url.element.request_url();
while redirect_count <= 3 {
match http_get_header(
@@ -224,7 +224,8 @@ impl SpamFilterAnalyzeUrl for Server {
)
.await
{
url_redirect = Cow::Owned(location.url);
url_redirect =
Cow::Owned(location.request_url().into_owned());
redirect_count += 1;
continue;
} else {
@@ -487,6 +488,15 @@ impl<'x> UrlParts<'x> {
.is_some_and(|url| url.host.fqdn.starts_with("www."))
}
pub fn request_url(&self) -> Cow<'_, str> {
let url = self.url_original.trim();
if self.has_scheme {
Cow::Borrowed(url)
} else {
Cow::Owned([HTTPS_SCHEME, url].concat())
}
}
fn parse(url: &str) -> Option<UrlParsed> {
url.parse::<Uri>().ok().and_then(|parts| {
parts
@@ -505,3 +515,19 @@ impl<'x> UrlParts<'x> {
}
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn request_url_keeps_case() {
let url = UrlParts::new(" https://Bit.ly/3AbCdEf ");
assert_eq!(url.url, "https://bit.ly/3abcdef");
assert_eq!(url.request_url(), "https://Bit.ly/3AbCdEf");
let url = UrlParts::no_scheme("Bit.ly/3AbCdEf");
assert_eq!(url.url, "https://bit.ly/3abcdef");
assert_eq!(url.request_url(), "https://Bit.ly/3AbCdEf");
}
}
+1 -3
View File
@@ -257,9 +257,7 @@ impl SpamClassifier for Server {
remove_entries = true;
}
if trainer.last_id == 0 {
trainer.last_id = id;
}
trainer.last_id = trainer.last_id.max(id);
Ok(true)
},