-
Notifications
You must be signed in to change notification settings - Fork 212
docs.rs/std/<path>?<args> should redirect path and args to doc.rust-lang #751
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Mentoring instructions:
Line 129 in 267adca
Line 54 in 267adca
Line 659 in 267adca
If you have any questions, feel free to ask here or on Discord! |
This looks like something I'd definitely use myself. I'll start working on this. |
Mhh, so something weird is going on. I first tried adding a new internal_page route just using the current RustLangRedirector: for redirect in DOC_RUST_LANG_ORG_REDIRECTS {
routes.internal_page(
&format!("/{}", redirect),
super::rustdoc::RustLangRedirector::new(redirect),
);
routes.internal_page(
&format!("/{}/*", redirect),
super::rustdoc::RustLangRedirector::new(redirect),
);
} Unfortunately this doesn't seem to work. E.g. going to routes.internal_page(
&format!("/{}/:something", redirect),
super::rustdoc::RustLangRedirector::new(redirect),
); and routes.internal_page(
&format!("/{}/test", redirect),
super::rustdoc::RustLangRedirector::new(redirect),
); will redirect for the corresponding GET requests. So then I thought it might be a bug in the old version of the router lib that is used, but this small repo https://github.com/robinhundt/test-iron-router/blob/master/src/main.rs seems to suggest that that is not the case, since the wildcard works just fine there. So I'm a little bit stumped as to why the handler is called for the normal or match pattern but not for the wildcard one. |
It may still be a bug in the router, maybe related to http-rs/route-recognizer#20 causing the priorities between the different routes to be wrong (I'm actually surprised that docs.rs has not hit this yet, on my other iron using project I encountered it almost straight away). |
Try updating the router, then? It looks like that issue was fixed in a later version. |
It's fixed in the underlying library the router uses, but afaik iron's router itself hasn't updated that library. |
Hmm, we might be able to use |
@Nemo157 you're right. It seems to be the route routes.rustdoc_page(
"/:crate/:version",
super::rustdoc::rustdoc_redirector_handler,
) that is more specific than |
Iron isn't really maintained, so I'm not sure how realistic it is to wait for that PR to be merged ... it's also unlikely they'd backport to 0.5, which we're still stuck on. I think this needs either a different approach in docs.rs or to wait for the switch to hyper (#747). |
Trying to get fixes into iron is probably a lost cause, like Joshua said. We can't move to 0.6 because of mysterious panics and some fun compile errors so even if they got in, we couldn't benefit from them |
Mhh, that's unfortunate. In the meantime we could use the pattern |
I'm working on this now so that we can have the new https://docs.rs/std::vec like urls too. |
it trips me up when docs.rs/std/ works but docs.rs/std/io doesn't
The text was updated successfully, but these errors were encountered: