diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-03-28 13:27:35 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-03-28 13:27:35 +0000 |
commit | c1718e988e24de48bf8ebe8d2421b4531dbe7b58 (patch) | |
tree | fdf8cbac970dc08dd22fa5740cb39c06867b59f3 /lib | |
parent | b78fa27ae0b717c5569878c106a67d5047e5fb88 (diff) | |
download | ruby-c1718e988e24de48bf8ebe8d2421b4531dbe7b58.tar.gz |
get rid of test error/failure on Windows introduced at r62955
* lib/webrick/httpresponse.rb (send_body_io): use seek if NotImplementedError
is raised in IO.copy_stream with offset.
* lib/webrick/httpservlet/filehandler.rb (multipart_body): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63008 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/webrick/httpresponse.rb | 7 | ||||
-rw-r--r-- | lib/webrick/httpservlet/filehandler.rb | 7 |
2 files changed, 12 insertions, 2 deletions
diff --git a/lib/webrick/httpresponse.rb b/lib/webrick/httpresponse.rb index 820579237f..6d77692140 100644 --- a/lib/webrick/httpresponse.rb +++ b/lib/webrick/httpresponse.rb @@ -433,7 +433,12 @@ module WEBrick size = @header['content-length'] size = size.to_i if size end - @sent_size = IO.copy_stream(@body, socket, size, offset) + begin + @sent_size = IO.copy_stream(@body, socket, size, offset) + rescue NotImplementedError + @body.seek(offset, IO::SEEK_SET) + @sent_size = IO.copy_stream(@body, socket, size) + end end ensure @body.close diff --git a/lib/webrick/httpservlet/filehandler.rb b/lib/webrick/httpservlet/filehandler.rb index e4d892ee66..0072e81ac6 100644 --- a/lib/webrick/httpservlet/filehandler.rb +++ b/lib/webrick/httpservlet/filehandler.rb @@ -100,7 +100,12 @@ module WEBrick "#{CRLF}" ) - IO.copy_stream(body, socket, last - first + 1, first) + begin + IO.copy_stream(body, socket, last - first + 1, first) + rescue NotImplementedError + body.seek(first, IO::SEEK_SET) + IO.copy_stream(body, socket, last - first + 1) + end socket.write(CRLF) end while parts[0] socket.write("--#{boundary}--#{CRLF}") |