diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-03-28 13:46:14 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-03-28 13:46:14 +0000 |
commit | 1bcd33fe7a7d8deafdae5bd6c5dbf68144632c89 (patch) | |
tree | 7fd02390a09aad8b824b06061d46702239438d6e /lib/webrick | |
parent | 543519d04838896811139e0596d235ce398d8a7b (diff) |
merge revision(s) 63008:
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/branches/ruby_2_5@63011 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/webrick')
-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}") |