-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Allow HTTP/0.9 responses behind a flag (fixes #2468) #2473
Conversation
I guess someone forgot to run tests and that someone was me. |
@seanmonstar Please tell me which kind of test you would want and in which file. |
I've filed an issue against rust-analyzer for that macro_rules indirection problem. |
I have removed the rust-analyzer |
We probably want this option to apply only to initial HTTP/1 requests and not those happening after the first one on a keep-alive connection. |
Nice work, thanks!
The tests in hyper are a little messy, but for this, there's probably 2 relevant places: in |
In addition to probably not wanting to interpret 0.9 responses on non-initial requests |
I added 3 tests and prevented accepting an HTTP/0.9 response after the first one we receive (though I didn't write a test for that but I will). |
Just checking, this has everything you meant to include? I don't see anything missing, but you mentioned a few questions that I see are now struck out, so just making sure. |
Yeah, the struck-out thought is that we don't need to care about h2 fallback given this is about responses, a detail I forgot when I wrote that :) As for the rest, it feels complete to me, but maybe we should have a test to check against HTTP/0.9 responses on a keep-alive connection after the first response? You decide. |
Hm, so, if we're reusing an HTTP/1.x connection, would it ever make sense for the server to have downgraded to HTTP/0.9? I want to say that the first response kind of solidifies the version of the whole connection, but maybe I'm wrong. If we assume it cannot downgrade, then that'd mean that any server that, after sending an HTTP/1.x response, decides to just start sending jibberish, we would assume it's busted... You know, thinking more, probably it's worth to enforce that, since I think a more likely scenario is a server accidentally sending a bigger body than it declared, and we would want to say it was an error, not another response in HTTP/0.9. Whatcha think? |
I think my code already refuses to ever downgrade to HTTP/0.9 after we received a first response, so I think we agree we should enforce that, yes, hah. Are there tests for keep-alive stuff already that I can take inspiration from? |
There are a few tests for keep-alive, but I think the way they are written is pretty bad. I've wanted to re-do hyper's test suite for a while now (it was some of the first Rust code I ever wrote, and instead of improving it, I've just adding junk on top). I'd probably rewrite those using I'm fine merging this without that specific test, to get it released sooner, unless you'd prefer I hold off. |
The two first commits work around some issues I had with VS Code and rust-analyzer.