Repository navigation
v. 0.5.0 - #8
v. 0.5.0#8
Conversation
…while conserving the classis website serving. Enhanced performance in file serving by replacing standard blocking functions with tokio asynchrone ones.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c65bca8fed
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let res = Response::error("400", "Bad Request"); | ||
|
|
||
| res.write_headers(&mut stream, &config).await?; | ||
| return Ok(()); |
There was a problem hiding this comment.
Send the 400 body when URL decoding fails
In handle, the decode(&request.path) error branch writes headers and immediately returns, but never writes res.body. Response::error("400", "Bad Request") sets a non-zero Content-Length, so malformed paths (for example invalid percent-encoding) produce truncated responses that violate the advertised length and can confuse strict HTTP clients/proxies. This should mirror the existing parse-error path by sending the body bytes before returning.
Useful? React with 👍 / 👎.
| return Ok(Response::redirect( | ||
| "301 Moved Permanently", | ||
| &format!("{file_path}/"), |
There was a problem hiding this comment.
Re-encode redirect targets built from decoded paths
serve_file now receives a decoded path, but the directory redirect still uses format!("{file_path}/") directly for the Location header. For requests like /My%20Docs (a valid encoded URI), this emits Location: /My Docs/, which is not a valid escaped URI and can be rejected or normalized inconsistently by clients. Build redirects from the original raw path or percent-encode the decoded path before setting Location.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Encoding the redirect path actually breaks the logic. If we leave it as it is, the redirect functionality remains unaffected.
As a Ferrox maintainer, I am very pleased to announce the release of Ferrox v. 0.5.0 which introduces a lot of new features.
urlencodingcrate. This resolves URL Parsing Issue #7ferrox.ymlfile (see example on the repo).