Skip to content

Commit 1d3d23a

Browse files
Nemo157Joshua Nelson
authored andcommitted
Fix permanent redirects using http protocol
1 parent 00ba0b2 commit 1d3d23a

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/web/routes.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -283,12 +283,10 @@ impl Handler for SimpleRedirect {
283283
struct PermanentRedirect(&'static str);
284284

285285
impl Handler for PermanentRedirect {
286-
fn handle(&self, req: &mut iron::Request) -> iron::IronResult<iron::Response> {
287-
let mut url: iron::url::Url = req.url.clone().into();
288-
url.set_path(self.0);
286+
fn handle(&self, _req: &mut iron::Request) -> iron::IronResult<iron::Response> {
289287
Ok(iron::Response::with((
290288
iron::status::MovedPermanently,
291-
iron::modifiers::Redirect(iron::Url::from_generic_url(url).unwrap()),
289+
iron::modifiers::RedirectRaw(self.0.to_owned()),
292290
)))
293291
}
294292
}

0 commit comments

Comments
 (0)