[Twisted-Python] Can browse, but getPage() fails on localhost address

Kevin Horn kevin.horn at gmail.com
Thu Oct 29 13:49:11 EDT 2009


On Thu, Oct 29, 2009 at 12:36 PM, Steve Steiner (listsin) <
listsin at integrateddevcorp.com> wrote:

> On Oct 29, 2009, at 1:10 PM, Maarten ter Huurne wrote:
>
> > On Thursday 29 October 2009, Steve Steiner (listsin) wrote:
> >
> >> I can browse to either URL in any browser, getPage() works fine on
> >> the
> >> external address, 404's on the localhost address.
> >
> > Does the same thing happen with "127.0.0.1" instead of "localhost"
> > in the
> > URL? I once encountered a nasty setup where a machine itself did not
> > have
> > "localhost" in /etc/hosts and the DNS server returned the IP address
> > of
> > another machine on the network...
>
> Yes, unfortunately, same thing and the hosts file is also correct.
>
> This is in OS X, and the valida†or URL I'm calling is being served by
> Apache 2.2, and is a ScriptAlias like so (in an includ of httpd.conf):
>
> ScriptAlias      /w3c-validator/check   '/Applications/Validator-
> SAC.app/Contents/Resources/validator/httpd/cgi-bin/check_wrapper.sh'
>
> Thing that's got me baffled is that I can go to it just fine in a
> browser, I can `curl` it, but, now, after a little more digging, wget
> can't get it either!
>
> So:
> curl  http://localhost/w3c-validator/check                         <--
> returns HTML code
> any browser to  http://localhost/w3c-validator/check  <-- returns HTML
> code
> t.w.c.getPage("http://localhost/w3c-validator/check") <-- 404
> wget  http://localhost/w3c-validator/check                 <-- 404
>
> So what the heck is the difference in how these things resolve that
> address!?
>
> Thanks,
>
> S
>
>
When you say "resolve that address" do you mean the IP Address  or the URL?

If the requests are in fact going to the same address (IP), I would take a
look at the HTTP headers for each method and compare them.  Wget failing in
a similar fashion to getPage() may actually help you diagnose this.

Kevin Horn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20091029/afe2d141/attachment.htm 


More information about the Twisted-Python mailing list