[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: url-encode-url: do not add a trailing slash for "bare" URLs (with no
From: |
Bastien |
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 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
Hi David,
David Caldwell <address@hidden> 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