-
Notifications
You must be signed in to change notification settings - Fork 52
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
Multiple Improvements #32
base: master
Are you sure you want to change the base?
Conversation
- SPA redirect to index.html when extensions are turned on - Protection from accessing files outside root by default. - Return rather than panic when failing to bind to socket.
// Serve the requested file. | ||
let resp = serve_file(&req, &config.root_dir).await; | ||
// Here we pass a `&PathBuf` to a function expecting a `&Path`. This works because of *deref | ||
// coercions*, in this case meaning that `PathBuf` implements `Deref` with `Target=Path`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is out of date. Needs removing.
|
||
impl std::str::FromStr for Auth { | ||
type Err = &'static str; | ||
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've made this parser very lenient, to the point that it cannot fail! I think it's still a good idea to leave it in FromStr
, so it could be made less lenient in the future by only altering code here.
Patiently awaiting these improvements 👍 |
Pingy ping 🙂 |
Hi @brson hope you don't mind another ping. I promise it's an easy to review PR. :) |
I've bundled up all my previous PRs into a single PR and added basic auth. I needed all this stuff for some use of my own, but hope that the work is useful to others. This PR includes
Closes #23
Closes #22
Closes #19