diff options
| author | Fuwn <[email protected]> | 2023-03-11 07:21:36 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2023-03-11 07:21:36 +0000 |
| commit | 9bf880157c758a660941ff5fc4e3dcd6ba08a06a (patch) | |
| tree | 0c641ef1ed0a6f55ce37fab1bee8c8469757ea5d /src/response.rs | |
| parent | fix(link): don't convert link to html (diff) | |
| download | september-9bf880157c758a660941ff5fc4e3dcd6ba08a06a.tar.xz september-9bf880157c758a660941ff5fc4e3dcd6ba08a06a.zip | |
feat(response): error on invalid proxy
Diffstat (limited to 'src/response.rs')
| -rw-r--r-- | src/response.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/response.rs b/src/response.rs index 393e3b8..5f56878 100644 --- a/src/response.rs +++ b/src/response.rs @@ -26,6 +26,20 @@ use crate::url::make as make_url; pub async fn default( req: actix_web::HttpRequest, ) -> Result<HttpResponse, Error> { + if vec![ + "/proxy", "/proxy/", "/x", "/x/", "/raw", "/raw/", "/nocss", "/nocss/", + ] + .contains(&req.path()) + { + return Ok( + HttpResponse::Ok() + .content_type("text/html") + .body(r#"<pre>This is a proxy path. Please specify a Gemini URL without the "gemini://" to proxy. + +For example: to proxy "gemini://fuwn.me/uptime", visit "/proxy/fuwn.me/uptime".</pre>"#), + ); + } + let mut is_proxy = false; let mut is_raw = false; let mut is_nocss = false; |