diff options
| author | Fuwn <[email protected]> | 2024-03-24 14:54:31 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2024-03-24 14:54:51 +0000 |
| commit | fc86be272fd4863adfd029d2cbb0b40fcf7cd8fe (patch) | |
| tree | 8f977ddad760d06e14e5286d032a937670cc9551 /src | |
| parent | format(response): capitalisation (diff) | |
| download | september-fc86be272fd4863adfd029d2cbb0b40fcf7cd8fe.tar.xz september-fc86be272fd4863adfd029d2cbb0b40fcf7cd8fe.zip | |
feat(response): support redirects
Diffstat (limited to 'src')
| -rw-r--r-- | src/response.rs | 14 | ||||
| -rw-r--r-- | src/url.rs | 1 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/response.rs b/src/response.rs index 345f6f5..717da4c 100644 --- a/src/response.rs +++ b/src/response.rs @@ -201,6 +201,20 @@ For example: to proxy "gemini://fuwn.me/uptime", visit "/proxy/fuwn.me/uptime".< germ::request::Status::Success => { html_context.push_str(&gemini_html.1); } + germ::request::Status::PermanentRedirect => { + html_context.push_str(&format!( + "<p>This page permanently redirects to <a href=\"{}\">{}</a>.</p>", + response.meta(), + response.meta().trim() + )); + } + germ::request::Status::TemporaryRedirect => { + html_context.push_str(&format!( + "<p>This page temporarily redirects to <a href=\"{}\">{}</a>.</p>", + response.meta(), + response.meta().trim() + )); + } _ => html_context.push_str(&format!("<p>{}</p>", response.meta())), } @@ -25,6 +25,7 @@ pub fn make( is_nocss: &mut bool, ) -> Result<Url, url::ParseError> { Ok( + #[allow(clippy::blocks_in_conditions)] match Url::try_from(&*if path.starts_with("/proxy") { *is_proxy = true; |