On Tue, 2008-11-11 at 16:57 -0800, Julien Phalip wrote:
> Hi,
> 
> The following URL is rejected when validating a URLField form field:
> http://portal.oas.org/Portal/Topic/SEDI/Educaci%C3%B3nyCultura/Cultura/ReunionesdelosMinistrosdeCultura/Cuartareuni%C3%B3nministerial/tabid/1416/language/en-US/language/es-CO/Default.aspx
> 
> Yet, that URL works perfectly in a browser. 
> The error I get is:
> "HTTP Error 302: The HTTP server returned a redirect error that would
> lead to an infinite loop.
> The last 30x error message was:
> Found"

The server at the remote end is a bit broken. When Django verifies a URL
exists, it sends an HTTP HEAD request. The response from that request is
a 302 response with a Location header pointing to the above URL. Which
leads to an infinite loop. That's usually a sign of something going
horribly wrong.

In fact, what they're expecting to happen is that the client will accept
their Set-Cookie header and then reload the page, sending back the
cookie and then they'll serve up the real page with yet another cookie
and a 200 response code (a couple of requests with "curl" verified
this). The problem is that if you're client doesn't accept cookies
(which can include web browsers), there's an infinite loop. So it's not
really a bug in urllib2 that it reports this as a problem. They (the
site you're accessing) really should be redirecting to a different URL.

> Is there a way around that, other than by switching "verify_exists"
off?

Not easily. The site you're accessing is configured in a fragile way and
it's biting you. You could write your own URLField form field that
handles this type of self-redirection, but it will require overriding
portions of urllib2's normal behaviour.

Regards,
Malcolm


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to