On Fri, Dec 14, 2007 at 09:00:01PM +0900, Andrwrote: > >> While I haven't tried this, I think you might be able to magically >> solve this simply through the wonders of the standard library: >> >> require 'resolv-replace' > >It worked great under Linux! Unfortunately, this seems not to work >under Windows... :( It simply doesn't resolve. I have no idea why it doesn't work under Windows - looking at the source it seems to have explicitly support it :( It might be worth experimenting with Socket.gethostbyname and see if it is returning any sort of useful errors? But I don't really know what you should be looking for, sorry :/ >I think this might be the way to go under Windows. The problem is: the >page where I'm downloading from depends on virtual host. So I can't >open with HTTP.new('10.20.30.40') since it'll return different results >that opening with HTTP.new('virtual.host.com'). > >Is there any way that I can open a HTTP connection with a IP and then >send a virtual host on the HTTP request? You'll need to set the 'Host' header on the request. So using your example before, do something like: http = Net::HTTP.new('127.0.0.1') ... http.start resp = http.get('/somefile.html', {'Host'=>'myhost.com'}) ... But getting the resolver to work properly is probably a better long term solution :) -- Stephen Lewis