-
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
Fixed chunk writing if the data is bugger than our buffer (#251) #252
Conversation
One related-looking test failure? (oh mocking IO...) Would be nice if we had a better strategy for write buffering in general. I'm pretty sure we run afoul of the pathological case for Nagle where do a small write immediately followed by another write. |
46214fb
to
7869ff2
Compare
:( socket mocking. I want to redo the test suite somepoint and pull in the one we use for our internal stuff, since that has a lot of edge case handling already too. Test failure should be fixed |
LGTM 👍 |
Fixed chunk writing if the data is bugger than our buffer (#251)
while data.present? | ||
length = @socket.write(data) | ||
if data.length > length | ||
data = data[length..-1] |
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.
This will allocate every time. I wonder if it would be possible to use #slice!
here to reduce allocations. Or maybe we just need real ByteBuffers
😕
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.
We call this using @body
as is, so we probably can't use slice!
, unless we call dup
beforehand.
Would need to benchmark to figure out if the optimization works out.
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.
Since Ruby strings are CoW anyway, this usage is probably efficient
## 0.9.8 (2015-09-29) * [#260](httprb/http#258): Fixed global timeout persisting time left across requests when reusing connections. ([@zanker][]) ## 0.9.7 (2015-09-19) * [#258](httprb/http#258): Unified strategy for handling exception-based and exceptionless non-blocking I/O. Fixes SSL support on JRuby 9000. ([@tarcieri][]) ## 0.9.6 (2015-09-06) * [#254](httprb/http#254): Removed use of an ActiveSupport specific method #present? ([@tarcieri][]) ## 0.9.5 (2015-09-06) * [#252](httprb/http#252): Fixed infinite hang/timeout when a request contained more than ~16,363 bytes. ([@zanker][]) ## 0.9.4 (2015-08-26) * Fixes regression when body streaming was failing on some URIs. See #246. (@zanker) * Fixes require timeout statements. See #243. (@ixti) ## 0.9.3 (2015-08-19) * Fixed request URI normalization. See #246. (@ixti) - Avoids query component normalization - Omits fragment component in headline ## 0.9.2 (2015-08-18) * Fixed exceptionless NIO EOF handling. (@zanker) ## 0.9.1 (2015-08-14) * Fix params special-chars escaping. See #246. (@ixti) ## 0.9.0 (2015-07-23) * Support for caching removed. See #240. (@tarcieri) * JRuby 9000 compatibility
## 0.9.8 (2015-09-29) * [#260](httprb/http#258): Fixed global timeout persisting time left across requests when reusing connections. ([@zanker][]) ## 0.9.7 (2015-09-19) * [#258](httprb/http#258): Unified strategy for handling exception-based and exceptionless non-blocking I/O. Fixes SSL support on JRuby 9000. ([@tarcieri][]) ## 0.9.6 (2015-09-06) * [#254](httprb/http#254): Removed use of an ActiveSupport specific method #present? ([@tarcieri][]) ## 0.9.5 (2015-09-06) * [#252](httprb/http#252): Fixed infinite hang/timeout when a request contained more than ~16,363 bytes. ([@zanker][]) ## 0.9.4 (2015-08-26) * Fixes regression when body streaming was failing on some URIs. See #246. (@zanker) * Fixes require timeout statements. See #243. (@ixti) ## 0.9.3 (2015-08-19) * Fixed request URI normalization. See #246. (@ixti) - Avoids query component normalization - Omits fragment component in headline ## 0.9.2 (2015-08-18) * Fixed exceptionless NIO EOF handling. (@zanker) ## 0.9.1 (2015-08-14) * Fix params special-chars escaping. See #246. (@ixti) ## 0.9.0 (2015-07-23) * Support for caching removed. See #240. (@tarcieri) * JRuby 9000 compatibility
No description provided.