mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 09:35:28 +00:00
fix Titan base replace
This commit is contained in:
parent
aa4f14ef29
commit
78bfae127d
1 changed files with 14 additions and 2 deletions
|
|
@ -404,7 +404,19 @@ fn handle(
|
||||||
// Expected target URL in response meta
|
// Expected target URL in response meta
|
||||||
match response.meta.data {
|
match response.meta.data {
|
||||||
Some(data) => match uri.parse_relative(data.as_str(), UriFlags::NONE) {
|
Some(data) => match uri.parse_relative(data.as_str(), UriFlags::NONE) {
|
||||||
Ok(target) => {
|
Ok(absolute) => {
|
||||||
|
// Replace Titan base
|
||||||
|
let target = Uri::build(
|
||||||
|
UriFlags::NONE,
|
||||||
|
"gemini",
|
||||||
|
absolute.userinfo().as_deref(),
|
||||||
|
absolute.host().as_deref(),
|
||||||
|
absolute.port(),
|
||||||
|
absolute.path().as_str(),
|
||||||
|
absolute.query().as_deref(),
|
||||||
|
absolute.fragment().as_deref(),
|
||||||
|
);
|
||||||
|
|
||||||
let total = redirects.take() + 1;
|
let total = redirects.take() + 1;
|
||||||
|
|
||||||
// Validate total redirects by protocol specification
|
// Validate total redirects by protocol specification
|
||||||
|
|
@ -417,7 +429,7 @@ fn handle(
|
||||||
redirects.replace(0); // reset
|
redirects.replace(0); // reset
|
||||||
|
|
||||||
// Disallow external redirection
|
// Disallow external redirection
|
||||||
} else if "gemini" != target.scheme().replace("titan", "gemini") // alias
|
} 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();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue