On Thu, 16 Apr 2009, e deleflie wrote:

> Hi Hugh,
> 
> Are you suggesting to extract the IP address of amazon's S3 servers?
> ... and use that instead of the domain name?

At runtime, rather than a constant.  It's a bit horrid, doing the 
work of the DNS in your own code, but if it solves things so you 
can come back to the issue later......
> 
> That was my first strategy a few days ago ... unfortunately, amazon
> rotate their IPs so doing this is not possible.

How frequently?  If it is like MX (mail exchangers) then it is
very dynamic, so it would be likely to fail.  How long will your
shoes app be up?

> 
> The code is already wrapped in a begin...rescue
> 
> I think I need to test the code on a windows install that isn't hosted
> on OSX ... I'll do that and get back.

In this thread I don't think you've shown us your failing code.  Maybe
that's worth considering, so people can expose it to XP, 2000, NT, ME
or Vista.  I think 98 and 95 are not likely to work well....
> 
> nslookup gives the following:

OK, I'll explain this as best as I can, but I still plead a lack of
knowledge about the details of DNS....
> 
> C:\Documents and Settings\etienne>nslookup blabla.s3.amazonaws.com
> *** Can't find server name for address 10.211.55.23: Non-existent domain

10.xx.yy.zz (or some subset of that, can't remember) are local addresses,
like 192.168.aa.bb  So it looks like this is looking at your router.
I've seen this and I didn't understand why it wasn't looking beyond the
router.  Maybe routers hold DNS servers so the ISP doesn't get clobbered
with every last request.
> *** Default servers are not available
> Server:  UnKnown

   that's just no name allocated

> Address:  10.211.55.23

   local address....
> 
> Non-authoritative answer:

DNS is a distributed system. If you add a machine you can't be expected
to tell someone on the other side of the planet about it, so you have
authority locally, or someone in your domain does, to setup authoritative
records.  DNS records get copied, and updated from time to time, so 
a non-authoritative answer may be out of date.  Or some miserable person
has corrupted a server deliberately.  So this data *could* be wrong, but
its the best we can get.

> Name:    s3-2-w.amazonaws.com
> Address:  207.171.191.245

  This is the address you want.  At the moment :-)

> Aliases:  blabla.s3.amazonaws.com
>           s3-directional-w.amazonaws.com
> 
> ... not sure what all that means. Is there a DNS error there? (if so
> then why would your example have worked)

No, I don't think there is an error there.  But someone with more knowledge
in this area may be able to shed more light on this.
> 
> Etienne
> 
        HTH
        Hugh

> On Thu, Apr 16, 2009 at 3:10 AM, Hugh Sasse <[email protected]> wrote:
> > On Thu, 16 Apr 2009, e deleflie wrote:
> >
> >> Hi Hughe
> >>
> >> > 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?
> >>
> >> the exact message is: "Hostname not known: blabla.s3.amazonaws.com"
> >> (without the 'blabla' ofcourse).
> >>
> >> Your sample code gives me "#<SocketError: Hostname not
> >> known:footlewuddlewix.ent" ... looks like the same message.
> >>
> >> When I substitute www.google.com, then your example works.
> >>
> >> Ok ... so maybe you are right, its not a DNS thing. But why would the
> >> identical code work on OSX ... ?
> >
> > Well, it is DNS related, but it doesn't look like a bug in the ruby side
> > of DNS matters.  So, wrapping whatever you're doing in a begin..rescue..end
> > block may be useful.  Maybe you'd want to use Alert instead of a para
> > in the error case.
> >
> > So we are now down to looking at how DNS gets queried on Windows.
> > I know about as much about that as one could braille on a stamp,
> > being more fluent in Unix, but being rather ignorant about DNS.
> > But the windows help (at least on vista) says that you can use
> > nslookup _address_
> > from the command prompt on windows.  nslookup with no arguments
> > tells me which server it is using.  nslookup /? gives a limited
> > amount of help, better to use it interactively (no arguments) then
> > type help.
> >
> > You can tell it which server to use.
> >
> > Ghastly horrid hack: use %x{...} to invoke nslookup if you are on
> > Windows, and extract the ip address....
> >
> >        Hugh
> >>
> >> Etienne
> >>
> >>
> >> > 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
> >> >> >
> >> >>
> >> >
> >>
> 

Reply via email to