On Wed, 15 Apr 2009, e deleflie wrote:
OK, if we can't get this to work, do you definitely get DNS errors
from net/http, or is this an inference based on a hang?
I just played with:
#!shoes
require 'net/http'
Shoes.app{
begin
para Net::HTTP.get URI.parse('http://footlewuddlewix.ent/')
rescue => e
para e.inspect
end
}
and if I don't have the rescue clause I just get a blank app for a nonexistent
domain, but I do get useful info in the shoes console (<alt-/>).
This works with a real working domain, producing the web page as raw
html in the para. With the begin...rescue I get useful results displayed.
Hugh
> Hi doki_pen,
>
> I tried doing:
>
> Shoes.setup do
> gem 'dnsruby'
> end
>
> require 'dnsruby'
> Resolv = Dnsruby::Resolv
>
> but Shoes then seems to hang permanently on "Looking for dnsruby". It
> could be a chicken and egg problem ... perhaps it cant find dnsruby
> because it cant resolve hostnames.
>
> What is strange is that the 'download' examples work fine ... (and
> they resolve the name google.com).
>
> So maybe it is something about Net::HTTP which breaks, whilst the
> 'download' method (which I think calls C++ code) works fine.
>
> Etienne
>
>
> On Mon, Apr 13, 2009 at 11:36 PM, doki_pen <[email protected]> wrote:
> > e deleflie wrote:
> >>>
> >>> On Mon, 13 Apr 2009, e deleflie wrote:
> >>>
> >>>
> >>>>
> >>>> Hi all,
> >>>>
> >>>> Does anyone know how to fix hostnames not resolving on windows? (they
> >>>> do in OSX). This is using net:http.
> >>>>
> >>>
> >>> It would be worth knowing whether
> >>> require 'resolv-replace'
> >>> fixes this.
> >>>
> >>
> >> it doesn't appear to ... but in my testing, I did get one successful
> >> resolving of a domain name (I kept trying an other 6 times all
> >> unsuccessful (no code changes))
> >>
> >> is it possible that resolving DNS it is inconsistent? (or am I going mad?)
> >>
> >> Etienne
> >>
> >
> > In my experience, ruby's resolv impl is horrid. I've been using dnsruby
> > with great success. I think that if there is a timeout on the first dns
> > server listed, then ruby gives up(doesn't catch the timeout exception and
> > try the next dns server). If you can't use dnsruby, then try switching the
> > order of your dns servers. BTW, this is how _I_ use dnsruby:
> >
> > require 'dnsruby'
> > Resolv = Dnsruby::Resolv
> >
>