emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Avoid a redirect loop in url-http


From: Diane Murray
Subject: Re: Avoid a redirect loop in url-http
Date: Thu, 12 Apr 2007 15:42:06 +0200

On Thu, 12 Apr 2007 Chong Yidong <address@hidden> wrote:

> Diane Murray <address@hidden> writes:

>> On occasion url-http gets stuck in an endless redirect loop.  This
>> can be fixed by simply checking if the number of redirected URLs in
>> `url-callback-arguments' hasn't gone over a certain number (which
>> could be a customizable variable).  If it has been redirected too
>> many times, rather than call `url-retrieve-internal' again,
>> `url-http-parse-headers' should just let the callback function get
>> activated - after adding a redirect error to
>> `url-callback-arguments', so that the callback knows that the
>> maximum number of redirects was reached.

> How about this patch?  It doesn't implement a defcustom as you
> suggested; it simply searches for a redirect loop.  It also simply
> signals an error if a loop is found.

I apologize for providing an explanation of the problem that was much
too brief.  Here's an example: There are sites that for some reason or
another keep returning redirect responses.  Some redirect to the same
host and file path but with slightly different query arguments,
possibly because the page expects a cookie to be set and url-cookie
doesn't allow it.  Other mischievous sites might do something similar
just to try and cause problems.  Since these are all distinct URLs,
they won't be equal, which is why I suggested checking how many times
the request has been redirected.

Regarding the error in your patch - if a real error is returned the
callback won't get called.  I think it would be better to add the
error to `url-callback-arguments' like the connection-failed error in
`url-http-async-sentinel' and to force a callback, so that the
function that calls url-retrieve/url-http can deal with things
appropriately.

--
Diane Murray




reply via email to

[Prev in Thread] Current Thread [Next in Thread]