-
Notifications
You must be signed in to change notification settings - Fork 130
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
Add a rust implementation. #42
Conversation
Thanks for the contribution. Unfortunately it seems to be failing the specs at the moment: http://www.todobackend.com/specs/index.html?https://todo-backend-rustful.herokuapp.com. |
Interesting. Maybe this is only failing in certain browsers. I'm using Chrome and when I run the tests the server returns "null" as the body for the todos that are created. Even trying to retrieve them via curl still results in a
I'm wondering whether the POST used by Chrome to create these todos is somehow different from the one used by Firefox, and that's causing your implementation to create the todos differently. Here's what Chrome is posting to create the todos during tests:
What's really weird is if I try to reproduce this by using what Chrome claims is the same request but exported as a curl command then everything works as expected:
I think I will need your help to figure out what's your implementation sees as different between what Chrome is sending and what curl is sending. |
Actually, when I subsequently ask Chrome to replay the same POST that created a null TODO it now succeeds! I'm now thinking perhaps your implementation has some sort of concurrency issue or race condition or something which shows up when the browser is firing off a large number of requests during the test run. Sound possible? |
Quite possible. The number of threads doesn't seem to be set, so there may be some congestion if the number of available CPU cores/threads are too low. This is a problem that is caused by the use of a thread pool in Hyper and it has been reported in hyperium/hyper#368. I implemented the Todo example in a quite naive way, so I'm not surprised if there are some other problems lurking around, that I didn't think about. |
For me the implementation only works if (google) Chrome is started with a --disable-web-security flag (Version 45.0.2421.0 dev (64-bit)). |
That's odd... There should not be a redirect, as far as I know, unless the actual list of allowed HTTP methods would count as it. |
Upgrading to Rustful 0.5 should make the congestion less of a problem. It has a mechanism that closes connections if the thread pool is about to become too occupied. It's not a solution, but a temporary measure until async IO is implemented. |
Rustful 0.5 upgrade done! The heroku app is up to date too. |
Tests look good now. Thanks for the contribution! |
No description provided.