Bug in open-uri under win32 (?)

From: Mauricio Fern疣dez <batsman.geo@...>
Date: 2004-05-16 08:00:33 UTC
List: ruby-core #2878

batsman@tux-chan:/tmp$ cat sdfsdfsd.rb
require 'open-uri'
dest = "test.rps"
src = "http://thekode.net/misc/rpa/types.rps"

File.open(dest, "wb") do |f|
    open(src, "rb") do |is|
        loop do
            dat = is.read(4096)
            break unless dat
            f.write dat
        end
    end
end

batsman@tux-chan:/tmp$ ruby sdfsdfsd.rb
batsman@tux-chan:/tmp$ ls -l test.rps
-rw-r--r--    1 batsman  batsman     20480 May 16 09:56 test.rps
batsman@tux-chan:/tmp$ md5sum test.rps
eb743caa3f0ade41c1bd8b9e3a602eba  test.rps


I'm told that this doesn't download the file correctly under windows
(only a few KB are dled). On visual inspection, the associated Tempfile
is not complete either, so the same behavior is observed when using
is.gets(nil) or a loop with eof?.


-- 
Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com

And Bruce is effectively building BruceIX
	-- Alan Cox

In This Thread

Prev Next