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 | 4aa7413b0f63a3b3cf899563b1b89712fb424990 (patch) | |
| tree | 329bce0b41d223c3c20286d984e2915514d9013c /lib | |
| parent | 1dc190ddb46a631c0152bb8e2812e4ba786d9373 (diff) | |
| download | ruby-4aa7413b0f63a3b3cf899563b1b89712fb424990.tar.gz ruby-4aa7413b0f63a3b3cf899563b1b89712fb424990.tar.xz ruby-4aa7413b0f63a3b3cf899563b1b89712fb424990.zip | |
aamine
* lib/net/protocol.rb: ignore EOFError for read.
* lib/net/http.rb: user specified header was not used.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@1132 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/net/http.rb | 2 | ||||
| -rw-r--r-- | lib/net/protocol.rb | 27 |
2 files changed, 18 insertions, 11 deletions
diff --git a/lib/net/http.rb b/lib/net/http.rb index 8925c498a..5b387f3a7 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 e2bb1f47c..7f99a64f9 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 |
