-
Notifications
You must be signed in to change notification settings - Fork 157
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
Router doesn't match any routes after a POST, thinks request is an Extension instead of a POST #326
Comments
Thanks @shepmaster for taking the time to report it here. @cburgdorf @simonpersson We should probably deal with this even if hyper doesn't (yet), perhaps by auto closing keep-alive requests if their body hasn't been fully read, or by reading up to a limit (as suggested in the hyper issue, but can be dangerous without a limit). |
This is the same as what @seanmonstar means with this right?
So, basically we are talking about requests that claim a content-length but then their body doesn't match that content-length? If that's the case that I think that would be my preferred approach of handling it but I have to admit that I don't think I get the full picture here ;) |
This puts a bandaid on nickel-org#326. A more complete fix will require some shuffling of the api exposed by Request so that we can monitor for when the body has been fully read (or read up to a defined limit).
Yes, that's the solution they've gone with on the async branch. I took a look at trying to attempt the same on the current sync api (in hyper itself) but what I came up with was pretty awful and would have required passing around
Not exactly, it would probably manifest itself as the same issue though. The problem is when a handler doesn't read the body, which leaves a load of junk in the buffer, which hyper then tries to interpret as the next request. I've pushed a weak fix up as a PR #327. I'd prefer if we had a better solution here but it's tricky to know when the body has been fully read with the current |
Related to this issue: nickel-org#326
Has this issue been fixed? I would like to use nickel for a project, but I'm encountering this same problem, which seems to render it pretty unusable. |
Ok, I got my code to work, but this still seems like something that ought to be fixed. |
I see it was last updated a month ago; perhaps I haven't been paying attention 😉 |
Development is going slow, although I hope to merge the serde migration soon. For this issue, I think it will need to wait until we migrate to a newer version of |
Originally reported on Stack Overflow.
Reproduction steps
Create a new Cargo project
Cargo.toml
main.rs
assets/login.tpl
What is expected: The form continues to be shown
What happens: The server returns an HTTP 404
Initial investigation
I added some debug prints to router.rs:
On the first POST, it iterates through the middleware with the following:
On the second POST, the incoming request's method is all screwy:
The text was updated successfully, but these errors were encountered: