unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Bastien <bzg@gnu.org>
To: David Caldwell <david@porkrind.org>
Cc: emacs-devel@gnu.org
Subject: Re: url-encode-url: do not add a trailing slash for "bare" URLs	(with no file/directory)
Date: Thu, 13 Mar 2014 09:06:35 +0100	[thread overview]
Message-ID: <87txb2msj8.fsf@bzg.ath.cx> (raw)
In-Reply-To: <loom.20140312T231450-992@post.gmane.org> (David Caldwell's	message of "Wed, 12 Mar 2014 22:28:11 +0000 (UTC)")

Hi David,

David Caldwell <david@porkrind.org> writes:

> The relevant RFC here is 3986 (https://tools.ietf.org/html/rfc3986). Section
> 3 (https://tools.ietf.org/html/rfc3986#page-16) talks about the
> syntax.

Thanks, I checked it before submitting the patch.

>> With the patch we have
>> 
>> (url-encode-url "http://www.gnu.org#")
>>   => http://www.gnu.org
>> 
>> instead of
>> 
>> (url-encode-url "http://www.gnu.org#")
>>   => http://www.gnu.org/
>> 
>> (no trailing slash with the patch), but I don't think
>> http://www.gnu.org# is correct anyway.
>
> That appears to be allowed by my reading of the RFC. The path is allowed to
> be empty, so http://www.gnu.org#something and http://www.gnu.org?some-query
> would both be valid. That being said, a quick test of curl shows that it
> doesn't like # right on the end:
>
>   $ curl 'http://www.gnu.org#someting'
>   curl: (6) Could not resolve host: www.gnu.org#something
>
> Firefox handles the same URL correctly.

OKay, but the patch does not really change the output of
(url-encode-url "http://www.gnu.org#"), except the for trailing slash.

> That being said, there's no point at all to elide the / at the
> root.

The point is: there is no point in adding it when it is not needed,
which is what the current code does.

Admittedly, this is not a bug, but a small discrepancy that makes bare
URLs looks weird/ugly.

Stefan, let me know if you're fine with the patch and if I can commit
this in trunk or on some other branch.

Thanks,

-- 
 Bastien



  reply	other threads:[~2014-03-13  8:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-12 10:19 url-encode-url: do not add a trailing slash for "bare" URLs (with no file/directory) Bastien
2014-03-12 13:40 ` Stefan Monnier
2014-03-12 14:05   ` Tim Visher
2014-03-12 14:42   ` Bastien
2014-03-12 22:28     ` David Caldwell
2014-03-13  8:06       ` Bastien [this message]
2014-03-13 13:12         ` Stefan Monnier
2014-03-13 13:50           ` Bastien

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87txb2msj8.fsf@bzg.ath.cx \
    --to=bzg@gnu.org \
    --cc=david@porkrind.org \
    --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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).