From 7adcec68b19c420381369917a93e4220f3e8f551 Mon Sep 17 00:00:00 2001 From: aamine Date: Tue, 16 Jan 2001 07:57:43 +0000 Subject: 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 --- ChangeLog | 6 ++++++ lib/net/http.rb | 2 +- lib/net/protocol.rb | 27 +++++++++++++++++---------- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index fe48b9e429..310c023c83 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Tue Jan 16 17:00:50 2001 Minero Aoki + + * lib/net/protocol.rb: ignore EOFError for read. + + * lib/net/http.rb: user specified header was not used. + Mon Jan 15 16:00:07 2001 Yukihiro Matsumoto * pack.c (pack_unpack): should check associated pointer packed by diff --git a/lib/net/http.rb b/lib/net/http.rb index 8925c498a2..5b387f3a7e 100644 --- a/lib/net/http.rb +++ b/lib/net/http.rb @@ -597,8 +597,8 @@ S key = canonical(k) if tmp.key? key then $stderr.puts "WARNING: duplicated HTTP header: #{k}" if $VERBOSE - tmp[ key ] = v.strip end + tmp[ key ] = v.strip end @u_header.update tmp end 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 -- cgit v1.2.3