all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Yuri Khan <yuri.v.khan@gmail.com>
To: Nicolas Petton <nicolas@petton.fr>
Cc: Stefan Monnier <monnier@iro.umontreal.ca>,
	Emacs developers <emacs-devel@gnu.org>
Subject: Re: 307 status code handling in url-http-parse-headers
Date: Mon, 1 Feb 2016 23:01:49 +0600	[thread overview]
Message-ID: <CAP_d_8W5YHnukJRZ2tqLL8Z0W_1K8+3qse9Rnp26QwinmvUrGg@mail.gmail.com> (raw)
In-Reply-To: <87oac0o64s.fsf@petton.fr>

On Mon, Feb 1, 2016 at 8:30 PM, Nicolas Petton <nicolas@petton.fr> wrote:

> I see that `url-http-parse-headers' won't redirect a 307 response for a
> POST request.
>
> There's a comment about 301/302 status codes, which says that for other
> requests than HEAD and GET, the user agent must not automatically
> redirect, which seems to follow the RFC.
>
> However, should we ask the user confirmation for the redirection and do
> the redirect depending on the user's choice?

The sad tale of HTTP redirections :(

HTTP/1.0 (RFC 1945) defined 301 and 302 requiring confirmation on
redirecting methods other than HEAD and GET. The intent was that it
was unknown whether the original handler performed the requested
operation before responding with a redirect. The intent was also that
in case of user confirmation the client would follow the redirect with
the original method.

Both browser implementors and web developers misunderstood the spec
and used 301 and 302 redirects to mean “I have performed the operation
you requested; follow the redirect with a GET to see results and/or
further instructions”.

RFC 2068 recognized the above use case and introduced the 303 code to
mean exactly that. It clarified that changing POST to GET on a 301 or
302 is an error. Still requires confirmation before redirecting
non-idempotent methods with 301 or 302, but not for 303.

HTTP/1.1 (RFC 2616) introduced the 307 code with pretty much the same
wording as RFC 2068 for 302, possibly in expectation that this time
developers will get it right. It required a confirmation on the 307,
as well as 301 and 302.

The current version of HTTP/1.1 (RFC 7231) no longer requires
confirmation on 301, 302 or 307. It documents that some clients MAY
(but actually should not) change POST to GET on 301 and 302. It
clarifies that clients MUST NOT change the method on a 307.



  parent reply	other threads:[~2016-02-01 17:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-01 14:30 307 status code handling in url-http-parse-headers Nicolas Petton
2016-02-01 14:54 ` Alexis
2016-02-01 15:01   ` Nicolas Petton
2016-02-01 17:01 ` Yuri Khan [this message]
2016-02-01 17:42   ` Nicolas Petton
2016-02-01 18:08     ` Yuri Khan
2016-02-02 22:28       ` Nicolas Petton
2016-02-03  0:27         ` Lars Ingebrigtsen
2016-02-03  8:49           ` Nicolas Petton
2016-02-03  9:24             ` Lars Ingebrigtsen
2016-02-03 10:27               ` Nicolas Petton
2016-02-04 17:00               ` Nicolas Petton

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=CAP_d_8W5YHnukJRZ2tqLL8Z0W_1K8+3qse9Rnp26QwinmvUrGg@mail.gmail.com \
    --to=yuri.v.khan@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=nicolas@petton.fr \
    /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.