Sophie

Sophie

distrib > Mandriva > 10.2 > x86_64 > by-pkgid > 7381418fd541ef8eeaf08c6d4d578c75 > files > 6

ruby-1.8.2-6.3.102mdk.src.rpm

Index: lib/webrick/httprequest.rb
===================================================================
RCS file: /var/cvs/src/ruby/lib/webrick/httprequest.rb,v
retrieving revision 1.5.2.2
diff -u -p -F^[^A-Za-z0-9_+-]*\(class\|module\|def\)[^A-Za-z0-9_+-] -r1.5.2.2 httprequest.rb
--- lib/webrick/httprequest.rb	22 Oct 2004 01:38:09 -0000	1.5.2.2
+++ lib/webrick/httprequest.rb	25 Sep 2005 07:01:24 -0000
@@ -306,7 +306,12 @@     def read_chunk_size(socket)
     def read_chunked(socket, block)
       chunk_size, = read_chunk_size(socket)
       while chunk_size > 0
-        data = read_data(socket, chunk_size) # read chunk-data
+        data = ""
+        while data.size < chunk_size
+          tmp = read_data(socket, chunk_size-data.size) # read chunk-data
+          break unless tmp
+          data << tmp
+        end
         if data.nil? || data.size != chunk_size
           raise BadRequest, "bad chunk data size."
         end
Index: lib/webrick/server.rb
===================================================================
RCS file: /var/cvs/src/ruby/lib/webrick/server.rb,v
retrieving revision 1.5.2.3
diff -u -p -F^[^A-Za-z0-9_+-]*\(class\|module\|def\)[^A-Za-z0-9_+-] -r1.5.2.3 server.rb
--- lib/webrick/server.rb	16 Dec 2004 09:45:59 -0000	1.5.2.3
+++ lib/webrick/server.rb	25 Sep 2005 07:01:24 -0000
@@ -90,6 +90,7 @@     def start(&block)
                 @tokens.pop          # blocks while no token is there.
                 sock = svr.accept
                 sock.sync = true
+                Utils::set_non_blocking(sock)
                 Utils::set_close_on_exec(sock)
                 th = start_thread(sock, &block)
                 th[:WEBrickThread] = true
Index: lib/webrick/utils.rb
===================================================================
RCS file: /var/cvs/src/ruby/lib/webrick/utils.rb,v
retrieving revision 1.3
diff -u -p -F^[^A-Za-z0-9_+-]*\(class\|module\|def\)[^A-Za-z0-9_+-] -r1.3 utils.rb
--- lib/webrick/utils.rb	28 Sep 2003 17:50:52 -0000	1.3
+++ lib/webrick/utils.rb	25 Sep 2005 07:01:24 -0000
@@ -18,6 +18,14 @@ end
 
 module WEBrick
   module Utils
+    def set_non_blocking(io)
+      flag = File::NONBLOCK
+      if defined?(Fcntl::F_GETFL)
+        flag |= io.fcntl(Fcntl::F_GETFL)
+      end
+      io.fcntl(Fcntl::F_SETFL, flag)
+    end
+    module_function :set_non_blocking
 
     def set_close_on_exec(io)
       if defined?(Fcntl::FD_CLOEXEC)