IO::write() throws Invalid Argument with HTTP::get()

Hi everyone,

I have a <15 line snippet below that fails when downloading a particular
60+MB file. I have tested it with other files >60MB and it works. This
one in particular is gives me trouble everytime. Any help is greatly
appreciated. -Chris


url = ‘
uri = URI.parse(url)

Net::HTTP.start(, 80) do |http|
response = http.get(uri.path)
mystr = response.body.to_s‘result’, ‘wb’) {|f|
count = f.write mystr

[2152] [[email protected]:~/hovitate/trunk/vuzit]
$ ruby test-dload.rb
test-dload.rb:11:in write': Invalid argument - result (Errno::EINVAL) from test-dload.rb:11 from test-dload.rb:10:inopen’
from test-dload.rb:10
from c:/ruby/lib/ruby/1.8/net/http.rb:543:in start' from c:/ruby/lib/ruby/1.8/net/http.rb:440:instart’
from test-dload.rb:6