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:
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "spam-filter"
|
||||
version = "0.16.23"
|
||||
version = "0.16.24"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user