mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-01-30 04:54:15 +00:00
update redirection rule
This commit is contained in:
parent
137301200f
commit
37a0c8ff4d
@ -399,8 +399,7 @@ fn handle(
|
|||||||
Status::PermanentRedirect | Status::Redirect => {
|
Status::PermanentRedirect | Status::Redirect => {
|
||||||
// Expected target URL in response meta
|
// Expected target URL in response meta
|
||||||
match response.meta.data {
|
match response.meta.data {
|
||||||
Some(data) => {
|
Some(data) => match uri.parse_relative(data.as_str(), UriFlags::NONE) {
|
||||||
match uri.parse_relative(data.as_str(), UriFlags::NONE) {
|
|
||||||
Ok(target) => {
|
Ok(target) => {
|
||||||
let total = redirects.take() + 1;
|
let total = redirects.take() + 1;
|
||||||
|
|
||||||
@ -414,7 +413,7 @@ fn handle(
|
|||||||
redirects.replace(0); // reset
|
redirects.replace(0); // reset
|
||||||
|
|
||||||
// Disallow external redirection
|
// Disallow external redirection
|
||||||
} else if uri.scheme() != target.scheme()
|
} else if "gemini" != target.scheme()
|
||||||
|| uri.port() != target.port()
|
|| uri.port() != target.port()
|
||||||
|| uri.host() != target.host() {
|
|| uri.host() != target.host() {
|
||||||
let status = subject.page.content.to_status_failure();
|
let status = subject.page.content.to_status_failure();
|
||||||
@ -442,7 +441,6 @@ fn handle(
|
|||||||
subject.page.title.replace(status.title());
|
subject.page.title.replace(status.title());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
None => {
|
None => {
|
||||||
let status = subject.page.content.to_status_failure();
|
let status = subject.page.content.to_status_failure();
|
||||||
status.set_description(Some("Redirection target not found"));
|
status.set_description(Some("Redirection target not found"));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user