all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Diane Murray <disumu@x3y2z1.net>
To: Chong Yidong <cyd@stupidchicken.com>
Cc: emacs-devel@gnu.org
Subject: Re: Avoid a redirect loop in url-http
Date: Thu, 12 Apr 2007 15:42:06 +0200	[thread overview]
Message-ID: <87slb5u2tt.fsf@x3y2z1.net> (raw)
In-Reply-To: <87tzvmrzs7.fsf@stupidchicken.com> (cyd@stupidchicken.com)

On Thu, 12 Apr 2007 Chong Yidong <cyd@stupidchicken.com> wrote:

> Diane Murray <disumu@x3y2z1.net> 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

  parent reply	other threads:[~2007-04-12 13:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-10  3:05 Avoid a redirect loop in url-http Diane Murray
2007-04-12  4:18 ` Chong Yidong
2007-04-12 10:25   ` Kim F. Storm
2007-04-12 13:42   ` Diane Murray [this message]
2007-04-12 15:48     ` Chong Yidong
2007-04-13 12:36       ` Diane Murray
2007-04-13 15:00         ` Chong Yidong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87slb5u2tt.fsf@x3y2z1.net \
    --to=disumu@x3y2z1.net \
    --cc=cyd@stupidchicken.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.