GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
Once more, now with feeling! It was nagging me why HTTP 1.0 GET's were not failing in unit testing, and yet they failed with curl in a sample app.
Well known use cases triggering HTTP 1.0 usage include using nginx as a reverse proxy, possibly others.
Test harness should not provide EOF marker
Clients who connect should not disconnect until they have a reply, so
parsing needs to complete successfully before we reach EOF.
Add test for HTTP 1.0 POST without Content-Length
Fix 1.0 POST to be RFC compliant
All requests with an entity body must have Content-Length set or
Transfer-Encoding set. Failure to do should result in HTTP 400 Bad
Request or HTTP 411 Length Required.
Only read to EOF if entity body present
All valid requests with an entity body will have Content-Length or
Transfer-Encoding set. Failure to do so should result in HTTP 400 Bad
Request or HTTP 411 Length Required. Parser should not wait for EOF to
Ignore MonoDevelop test results
Could you split this out into a separate test, and explicitly define the behavior when the Content-Length is missing?
If you look into e405487 you'll find it tests exactly the situation where the client uploads something and doesn't provide CL or TE (which is what this test was testing before). Regarding defining the behavior, I didn't put it in because I was looking at HttpMachine as a mere parser, so I thought it should bubble up for Kayak to reply. Am I assuming too much ?
Maybe there could be a flag on TestRequest that indicates to the test harness whether or not it should execute this line? Would that be a step towards explicitly nailing down the behavior for malformed requests?
The only edge case I see using that flag would be simulating a client that disconnects before we reply to it's last request [possibly with > 0 requests sent previously]. But if the client disconnects we dont' care about parsing anymore. Kayak should release the socket and move on, client will never read our response.
What kind of malformed requests are you thinking about ?
I've had a look at this stuff on my laptop this morning, and I'm satisfied with all of it. Thanks Marco!
Merge pull request #7 from mcunha/fix-http-1.0
Fix http 1.0