How to get rpm file with ruby?

Neither of the methods below are able to download this rpm file. If
you use firefox it works fine, how can I do this in ruby as part of a
install script I am trying to write in ruby ?


require ‘net/http’

Net::HTTP.start(“apt.sw.be”) { |http|
resp = http.get(“/redhat/el5/en/x86_64/rpmforge/RPMS//rpmforge-
release-0.3.6-1.el5.rf.x86_64.rpm”)
open(“postgis.rpm”, “wb”) { |file|
file.write(resp.body)
}
}

##########################

open(‘http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS/rpmforge-
release-0.3.6-1.el5.rf.x86_64.rpm’)

Jedrin wrote:

Neither of the methods below are able to download this rpm file.

Please post the exact error message you see (or other symptom - e.g.
does it hang? do you see a zero-byte file? something else?)

It looks all right to me. In irb:

require ‘net/http’
=> true

resp = Net::HTTP.start(“apt.sw.be”) { |http| http.get("/redhat/el5/en/x86_64/rpmforge/RPMS//rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm") }
=> #<Net::HTTPOK 200 OK readbody=true>

resp.body.size
=> 16697

resp[‘Content-Type’]
=> “application/x-redhat-package-manager”

RUBY_DESCRIPTION
=> “ruby 1.8.7 (2010-01-10 patchlevel 249) [x86_64-linux]”

Perhaps you are behind a proxy or something, and you have firefox
configured to use that proxy?