LOG_off had no counterpart on the exception path, so a raise from the
block or from the source silenced the connection's debug_output for
good. The two success cases go with them because the restructure
rewrote the method that had no coverage at all.
https://github.com/ruby/net-protocol/commit/8ce0d36836
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The case had no branch for it, so the retry loop spun without waiting
and without ever reaching the write_timeout. The fake refuses the write
until it has been waited on, which turns a regression into a failure
rather than a hang.
https://github.com/ruby/net-protocol/commit/6f09388722
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
readuntil buffers until the terminator arrives, so a peer that never
sends one grows the read buffer without bound. The limit lets a protocol
implementation cap what a single read may return, raising the new
Net::ReadLimitExceeded instead of reading on.
The exception derives from ProtocolError because an over-long line is
the peer violating the protocol rather than an I/O failure, and because
IOError would place it in the generic socket-error rescue that Net::HTTP
retries on.
https://github.com/ruby/net-http/issues/315https://github.com/ruby/net-protocol/commit/e1b38d98b7
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Cover a terminator split across two reads and across more than two, the
negative rewind the floor clamps, the floor keeping the search out of
consumed bytes, and the ignore_eof branch that returns data without a
terminator. FakeReadPartialIO now signals EOF instead of raising
TypeError, and hands out binary chunks so @rbuf stays binary the way a
real IO leaves it.
https://github.com/ruby/net-protocol/commit/215cc35666
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* test/net/protocol/test_protocol.rb (TestProtocol#create_mockio):
max option to limit maximum writable size at once, and unify
mock method in test_write0_multibyte.
This commit should fix Net::Protocol::BufferedIO#write when sending
large multi-byte string like following example.
```
$ ruby -rnet/http -rjson -v -e "Net::HTTP.post(URI('http://httpbin.org/post'), { text: 'あ'*100_000 }.to_json, 'Content-Type' => 'application/json')"
ruby 2.6.0p0 (2018-12-25 revision 66547) [x86_64-linux]
Traceback (most recent call last):
19: from -e:1:in `<main>'
18: from lib/ruby/2.6.0/net/http.rb:500:in `post'
17: from lib/ruby/2.6.0/net/http.rb:605:in `start'
16: from lib/ruby/2.6.0/net/http.rb:920:in `start'
15: from lib/ruby/2.6.0/net/http.rb:502:in `block in post'
14: from lib/ruby/2.6.0/net/http.rb:1281:in `post'
13: from lib/ruby/2.6.0/net/http.rb:1493:in `send_entity'
12: from lib/ruby/2.6.0/net/http.rb:1479:in `request'
11: from lib/ruby/2.6.0/net/http.rb:1506:in `transport_request'
10: from lib/ruby/2.6.0/net/http.rb:1506:in `catch'
9: from lib/ruby/2.6.0/net/http.rb:1507:in `block in transport_request'
8: from lib/ruby/2.6.0/net/http/generic_request.rb:123:in `exec'
7: from lib/ruby/2.6.0/net/http/generic_request.rb:189:in `send_request_with_body'
6: from lib/ruby/2.6.0/net/protocol.rb:247:in `write'
5: from lib/ruby/2.6.0/net/protocol.rb:265:in `writing'
4: from lib/ruby/2.6.0/net/protocol.rb:248:in `block in write'
3: from lib/ruby/2.6.0/net/protocol.rb:275:in `write0'
2: from lib/ruby/2.6.0/net/protocol.rb:275:in `each_with_index'
1: from lib/ruby/2.6.0/net/protocol.rb:275:in `each'
lib/ruby/2.6.0/net/protocol.rb:280:in `block in write0': undefined method `bytesize' for nil:NilClass (NoMethodError)
```
[Fix GH-2058]
From: Eito Katagiri <eitoball@gmail.com>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66582 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
StringIO.new makes the buffer IO.default_external, while
StringIO.new("".dup) makes source encoding which is defaulted to
UTF-8.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57328 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
When you change this to true, you may need to add more tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e