all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Daniele Nicolodi <daniele@grinta.net>
To: emacs-devel@gnu.org
Subject: Re: Bug in url-retrieve-synchronously from url.el on redirect
Date: Fri, 10 Jul 2020 13:43:16 -0600	[thread overview]
Message-ID: <8d25cbf6-5cc8-25d5-89bc-5a7a74d477c4@grinta.net> (raw)
In-Reply-To: <CAP_d_8XS-d+uxktjb8pgBV8XHmvnJgemygdo8rVEw+p8pjWGgw@mail.gmail.com>

On 10/07/2020 12:49, Yuri Khan wrote:
> On Sat, 11 Jul 2020 at 01:18, Daniele Nicolodi <daniele@grinta.net> wrote:
> 
>> url-retrieve-synchronously fails to obey redirect responses if the
>> returned "Location" header contains spaces: it redirects to the URL
>> truncated to the first space. It seems that spaces in the Location
>> header value are allowed (at least ngnix produces headers like that).
> 
> They are not, and you should report it as a bug against nginx. It
> should be percent-encoding the space. It should also be
> percent-encoding any non-ASCII characters.
> 
> The Location header is defined in RFC 7231, section 7.1.2, with a
> value of URI-reference as defined in RFC 3986. The complete BNF
> grammar is listed in Appendix A, and none of the productions there
> contain the raw space character, nor raw non-ASCII characters.

Thanks for the explanation.

As far as I understand the RFCs (and being wrong before, I may be wrong
again) do not allow for < > quoting either. Why does url-http.el strip
them? Why does it break the URI at the first space if spaces are not
allowed?

I would apply the old "be liberal in what you accent and strict in what
you emit" wisdom here. Indeed, all the HTTP implementations I tested,
except Emacs, interpret the Location header with spaces as most likely
intended.

Cheers,
Dan



  parent reply	other threads:[~2020-07-10 19:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-10 18:18 Bug in url-retrieve-synchronously from url.el on redirect Daniele Nicolodi
2020-07-10 18:49 ` Yuri Khan
2020-07-10 19:37   ` Yuri Khan
2020-07-10 19:46     ` Daniele Nicolodi
2020-07-10 19:43   ` Daniele Nicolodi [this message]
2020-07-10 20:25     ` Yuri Khan
2020-07-10 20:32       ` Daniele Nicolodi
2020-07-11  0:55         ` Daniele Nicolodi
2020-07-13 18:15           ` chad
2020-07-13 18:48             ` Daniele Nicolodi

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=8d25cbf6-5cc8-25d5-89bc-5a7a74d477c4@grinta.net \
    --to=daniele@grinta.net \
    --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.