-
Notifications
You must be signed in to change notification settings - Fork 321
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
back to io/wait #368
back to io/wait #368
Changes from 18 commits
2590ac2
5a25cb7
b04a0db
f5b22e5
ca55acf
21f9d34
4a39a8b
f79bf10
f0f0231
48c3e85
93c9ce9
73f0816
00279ae
9a2dea1
c36d357
83f3b32
08ec27d
9c18fe3
6a13e2a
108e127
607e42b
4a90c6c
21c0f60
7fc577b
5b19215
8d84978
0346723
a77e80e
a6afeeb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,7 +53,10 @@ def to_s | |
@streaming = false | ||
@contents = String.new("").force_encoding(encoding) | ||
|
||
while (chunk = @stream.readpartial) | ||
length = @length || Float::INFINITY | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @tarcieri the purpose of this variable got lost in the rebase. I was passing the content length (when available) to the body to prevent mismatches and eventual infinite loops. But the initialize signature changed. I leave the decision to you to take advantage of this or remove it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should follow your initial idea of limiting amount of data to given Content-Length when available and should be respected according to RFC. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ixti agree, but how should I "import" the length? The initializer signature changed, and I lost my assumptions. Just in case this PR takes again longer than planned: what do you suggest as the long term way to pass the content length from the response to the body? When I implemented it, I changed the signature to use kwargs and added the encoding and content length as optional parameters. Can I go back to that strategy? as @tarcieri said, this is anyway planned to a major bump, so in theory I could. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, go ahead. I'm fine with keyword args. And it won't take long this time, I promise - will merge as soon as it's ready :D before this weekend. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Famous last words :D I have a tentative commit here which I don't know if I'll include: I was going to make I pass the potato to you. |
||
|
||
while (length > 0 && chunk = @stream.readpartial) | ||
length -= chunk.bytesize | ||
@contents << chunk.force_encoding(encoding) | ||
end | ||
rescue | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we're gonna release this PR as part of
v3.0.0
it worth to change this to be will be removed in v3.1.0There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But if it is to be removed in 3.0.0 and this PR is about 3.0.0, then why not just go and remove support? I'd save this tweak to upstream though, it's beyond the scope of the PR IMO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mmm. I guess I'm agree. Just remove this deprecated class then.