mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-03-13 06:01:21 +00:00
update comments
This commit is contained in:
parent
86d191cc46
commit
5637e5a44f
@ -159,7 +159,7 @@ fn redirect(
|
|||||||
priority: Priority,
|
priority: Priority,
|
||||||
is_foreground: bool,
|
is_foreground: bool,
|
||||||
) -> Response {
|
) -> Response {
|
||||||
// Validate redirect according to
|
// Validate redirection attempt
|
||||||
// [Gemini protocol specifications](https://geminiprotocol.net/docs/protocol-specification.gmi#redirection)
|
// [Gemini protocol specifications](https://geminiprotocol.net/docs/protocol-specification.gmi#redirection)
|
||||||
if referrer.len() > 5 {
|
if referrer.len() > 5 {
|
||||||
return Response::Failure(Failure::Error {
|
return Response::Failure(Failure::Error {
|
||||||
@ -167,6 +167,7 @@ fn redirect(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
match data {
|
match data {
|
||||||
|
// Target address could be relative, parse using base Uri
|
||||||
Some(target) => match Uri::parse_relative(&base, target.as_str(), UriFlags::NONE) {
|
Some(target) => match Uri::parse_relative(&base, target.as_str(), UriFlags::NONE) {
|
||||||
Ok(target) => {
|
Ok(target) => {
|
||||||
// Disallow external redirection
|
// Disallow external redirection
|
||||||
@ -181,7 +182,9 @@ fn redirect(
|
|||||||
}); // @TODO placeholder page with optional link open button
|
}); // @TODO placeholder page with optional link open button
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build request
|
// Build new `Request` for redirection `Response`
|
||||||
|
// * make sure that `referrer` already contain current `Request`
|
||||||
|
// (to validate redirection count in chain)
|
||||||
let request =
|
let request =
|
||||||
Request::build(&target.to_string(), Some(referrer), cancellable, priority);
|
Request::build(&target.to_string(), Some(referrer), cancellable, priority);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user