-
-
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
Add handling for invalid responses to Response.from_io #5630
Add handling for invalid responses to Response.from_io #5630
Conversation
Careful with making HTTP more strict than it should. With this, does Servers are not well implemented and browsers still accept them. The http server should tolerate these small errors and act accordingly without failing fast. |
This PR just adds some sanity checks to make sure the io actually contains an HTTP response. This is very basic. While I dont think a dedicated HTTP client API should have such quirky behaviour. At least not as default. |
fc47665
to
dc75592
Compare
@straight-shoota This looks great and will benefit me greatly when merged. |
Before merging this, I'd like someone to test go's http client and see if it applies the same quirky things as curl. I'm pretty sure it does, and that this PR should not be merged. The internet is a jungle and not all servers are well implemented and http client must be super tolerant and flexible about this. |
@asterite I haven't actually verified everything through running code, but from reading Go
This PR ends up doing the same except enforcing protocol to be |
Just for fun: we don't support HTTP 0.9! There are no headers, no status line in responses (only the body), no keep-alive, and it's not even supposed to support binary contents.
|
So I guess we can merge this, except dropping support for HTTP 0.9 (or just checking that it's a digit-dot-digit). |
@ysbaddaden Hm, I don't know why I was under the impression it was supported, but clearly it is not. It should be removed from supported versions then. |
dc75592
to
5b4bdd1
Compare
I removed HTTP/0.9 from supported versions. |
Partly fixes #5621