Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/web/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ impl CratesfyiHandler {
router.get("/robots.txt", sitemap::robots_txt_handler, "robots_txt");
router.get("/sitemap.xml", sitemap::sitemap_handler, "sitemap_xml");
router.get("/opensearch.xml", opensearch_xml_handler, "opensearch_xml");
router.get("/std", rustdoc::std_redirector_handler, "std");
router.get("/releases", releases::recent_releases_handler, "releases");
router.get("/releases/feed",
releases::releases_feed_handler,
Expand Down
6 changes: 6 additions & 0 deletions src/web/rustdoc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ impl ToJson for RustdocPage {
}


/// Handler called for the `/std`. Redirects to the official standard library docs.
pub fn std_redirector_handler(_req: &mut Request) -> IronResult<Response> {
let url = Url::parse("https://doc.rust-lang.org/stable/std/").unwrap();
Ok(Response::with((status::Found, Redirect(url))))
}

/// Handler called for `/:crate` and `/:crate/:version` URLs. Automatically redirects to the docs
/// or crate details page based on whether the given crate version was successfully built.
pub fn rustdoc_redirector_handler(req: &mut Request) -> IronResult<Response> {
Expand Down