diff options
author | aamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-01-16 07:57:43 +0000 |
---|---|---|
committer | aamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-01-16 07:57:43 +0000 |
commit | 7adcec68b19c420381369917a93e4220f3e8f551 (patch) | |
tree | 329bce0b41d223c3c20286d984e2915514d9013c /lib/net/protocol.rb | |
parent | c46cf18e3b336027f9b124b31007702b7ee025ba (diff) | |
download | ruby-7adcec68b19c420381369917a93e4220f3e8f551.tar.gz |
aamine
* lib/net/protocol.rb: ignore EOFError for read.
* lib/net/http.rb: user specified header was not used.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1132 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/net/protocol.rb')
-rw-r--r-- | lib/net/protocol.rb | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/lib/net/protocol.rb b/lib/net/protocol.rb index e2bb1f47ca..7f99a64f97 100644 --- a/lib/net/protocol.rb +++ b/lib/net/protocol.rb @@ -504,9 +504,13 @@ module Net @pipe << "reading #{len} bytes...\n" if @pipe; pipeoff rsize = 0 - while rsize + @buffer.size < len do - rsize += writeinto( dest, @buffer.size ) - fill_rbuf + begin + while rsize + @buffer.size < len do + rsize += writeinto( dest, @buffer.size ) + fill_rbuf + end + rescue EOFError + len = rsize end writeinto( dest, len - rsize ) @@ -534,14 +538,17 @@ module Net def readuntil( target ) - while true do - idx = @buffer.index( target ) - break if idx - fill_rbuf - end - dest = '' - writeinto( dest, idx + target.size ) + begin + while true do + idx = @buffer.index( target ) + break if idx + fill_rbuf + end + writeinto( dest, idx + target.size ) + rescue EOFError + writeinto( dest, @buffer.size ) + end dest end |