Skip to content
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

Raise EOF if response body content length is known #2074

Closed
wants to merge 2 commits into from

Conversation

joshcooper
Copy link
Contributor

@joshcooper joshcooper commented Jan 22, 2019

If response body content length is known, then read the complete
response body or raise EOF if it is truncated.

[Bug #14972][ruby-core:88324]

@joshcooper joshcooper changed the base branch from trunk to master August 12, 2019 21:15
@joshcooper
Copy link
Contributor Author

Per https://tools.ietf.org/html/rfc7230#section-3.4:

A message that uses a valid Content-Length is incomplete
if the size of the message body received (in octets) is less than the
value given by Content-Length.

If response body content length is known, then read the complete
response body or raise EOF if it is truncated.

[Bug #14972][ruby-core:88324]
joshcooper added a commit to joshcooper/puppet-runtime that referenced this pull request Aug 12, 2019
Net::HTTP has a bug where it will silently ignore EOF if it downloads
fewer than <Content-Length> bytes[1]. Patch ruby 2.4 and 2.5 on all
platforms. This is the same as the upstream PR[2].

[1] https://bugs.ruby-lang.org/issues/14972
[2] ruby/ruby#2074
joshcooper added a commit to joshcooper/puppet-runtime that referenced this pull request Aug 13, 2019
Net::HTTP has a bug where it will silently ignore EOF if it downloads
fewer than <Content-Length> bytes[1]. Patch ruby 2.4 and 2.5 on all
platforms. This is the same as the upstream PR[2].

[1] https://bugs.ruby-lang.org/issues/14972
[2] ruby/ruby#2074
@jeremyevans
Copy link
Contributor

The net-http gem now has its own repository, so this should be closed. I added a pull request to that repository that offers a way to support this in a backwards compatible manner, as requested by @nurse: ruby/net-http#15.

@jeremyevans jeremyevans closed this Mar 1, 2021
@joshcooper joshcooper deleted the http_14972 branch March 1, 2021 23:39
@joshcooper
Copy link
Contributor Author

Thanks @jeremyevans!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants