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: Tue, 2 Feb 2016 00:08:00 +0600	[thread overview]
Message-ID: <CAP_d_8XhBwCiu_otY+e3oDiwJcMHq6e-icMeVcWkfK3MO91Ucg@mail.gmail.com> (raw)
In-Reply-To: <87egcwnx88.fsf@petton.fr>

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

> What should we do then?  The current implementation seems to just
> ignores the redirection, I would at least ask the user for a
> confirmation.

That’s the million dollar question, of course :)

Well-behaved contemporary sites should probably not respond with 301
and 302 to POST requests, preferring 303 for “I have processed your
request, now please navigate to this new page” and 307 for “I have not
processed your request but the handler on that other URI might”.

Older sites probably expect 301s and 302s to be handled by the client
in the fashion that is correct for 303. Sites that use 301 and 302
redirects as intended expect them to be handled like 307.

If I were designing an HTTP client library now, I would handle 301 and
302 the same way as 307 by default: no confirmation, no method change,
send the same request data. But I would provide an escape hatch — a
single flag that, when explicitly specified, forbids following
redirects and just returns the 30x codes to the application which
should then decide what to do. I would cite RFC 7231 to everybody who
complained about my choice of defaults ;)

cURL does not follow redirects by default. When directed to with the
-L/--location switch, it defaults to changing the method to GET for
301, 302 and 303 but keeping the original method for 307. It has
further switches --post301, --post302 and the bizarre --post303 to
keep POST method for these respective redirects. Its manual says the
default behavior is non-compliant.

Wget, on the other hand, keeps the original method on 301, 302 and
307, and the manual says it is with accordance to RFC 2616.



  reply	other threads:[~2016-02-01 18:08 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
2016-02-01 17:42   ` Nicolas Petton
2016-02-01 18:08     ` Yuri Khan [this message]
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_8XhBwCiu_otY+e3oDiwJcMHq6e-icMeVcWkfK3MO91Ucg@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.