[前][次][番号順一覧][スレッド一覧]

ruby-changes:50802

From: usa <ko1@a...>
Date: Wed, 28 Mar 2018 22:27:45 +0900 (JST)
Subject: [ruby-changes:50802] usa:r63008 (trunk): get rid of test error/failure on Windows introduced at r62955

usa	2018-03-28 22:27:35 +0900 (Wed, 28 Mar 2018)

  New Revision: 63008

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=63008

  Log:
    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.

  Modified files:
    trunk/lib/webrick/httpresponse.rb
    trunk/lib/webrick/httpservlet/filehandler.rb
Index: lib/webrick/httpservlet/filehandler.rb
===================================================================
--- lib/webrick/httpservlet/filehandler.rb	(revision 63007)
+++ lib/webrick/httpservlet/filehandler.rb	(revision 63008)
@@ -100,7 +100,12 @@ module WEBrick https://github.com/ruby/ruby/blob/trunk/lib/webrick/httpservlet/filehandler.rb#L100
                 "#{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}")
Index: lib/webrick/httpresponse.rb
===================================================================
--- lib/webrick/httpresponse.rb	(revision 63007)
+++ lib/webrick/httpresponse.rb	(revision 63008)
@@ -433,7 +433,12 @@ module WEBrick https://github.com/ruby/ruby/blob/trunk/lib/webrick/httpresponse.rb#L433
             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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]