From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Bastien Newsgroups: gmane.emacs.devel 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 Message-ID: <87txb2msj8.fsf@bzg.ath.cx> References: <87k3bzhg81.fsf@bzg.ath.cx> <87siqnzded.fsf@bzg.ath.cx> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1394698010 22832 80.91.229.3 (13 Mar 2014 08:06:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 13 Mar 2014 08:06:50 +0000 (UTC) Cc: emacs-devel@gnu.org To: David Caldwell Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Mar 13 09:06:56 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WO0fI-0007oP-BL for ged-emacs-devel@m.gmane.org; Thu, 13 Mar 2014 09:06:56 +0100 Original-Received: from localhost ([::1]:37400 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WO0fH-0003pq-Ph for ged-emacs-devel@m.gmane.org; Thu, 13 Mar 2014 04:06:55 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40960) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WO0fA-0003pi-Uo for emacs-devel@gnu.org; Thu, 13 Mar 2014 04:06:53 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WO0f6-00070h-Fb for emacs-devel@gnu.org; Thu, 13 Mar 2014 04:06:48 -0400 Original-Received: from rs249.mailgun.us ([209.61.151.249]:49653) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WO0f6-00070R-8J for emacs-devel@gnu.org; Thu, 13 Mar 2014 04:06:44 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=kickhub.com; q=dns/txt; s=mailo; t=1394698002; h=From: To: Cc: Subject: In-Reply-To: References: Date: Message-Id: Mime-Version: Content-Type: Sender; bh=vpijDePqNA/151qazSRHQq3YPUk/e43CYR/ANOsDxcI=; b=cbUGmr46uj+qirQRh4Gl7Lq4bDRwItENNPg8Rt0ANpLIVOThZDzI8UwxrujuJQn761jVkG7H N360yYNp2yYUgPMrazdj8NBcVsMyxZRt8OaU23xxnyOeRZ4L4ABKgxDcBQIzIOsqfYxnT/k4 XBDzUsulOeGNaNqseLf2NdoFimk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=kickhub.com; s=mailo; q=dns; h=From: To: Cc: Subject: In-Reply-To: References: Date: Message-Id: Mime-Version: Content-Type: Sender; b=UYy5ErAiyejZYyYhxySaRZZJPZP6v2V/UlQv3rp/LpYn19FBb25VwsVuE6RXtTRKvlnhcP KDxj2K4B1QS4ghoHlMyg5jRWZXauohJNWi1BRebfbIfXkztFGEIVBCNtvIxycZfqzNgc118H duvuIKIqrmKuqYkTZSUACiZJ9BHDw= Original-Received: from bzg.localdomain (AMontsouris-651-1-244-140.w92-163.abo.wanadoo.fr [92.163.19.140]) by mxa.mailgun.org with ESMTP id 5321670f.7ff7454bece0-in3; Thu, 13 Mar 2014 08:06:39 -0000 (UTC) Original-Received: by bzg.localdomain (Postfix, from userid 1000) id B443E1C214FB; Thu, 13 Mar 2014 09:06:35 +0100 (CET) In-Reply-To: (David Caldwell's message of "Wed, 12 Mar 2014 22:28:11 +0000 (UTC)") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-Mailgun-Sid: WyIxNjA5MyIsICJlbWFjcy1kZXZlbEBnbnUub3JnIiwgIjE2NDg4Il0= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.61.151.249 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:170307 Archived-At: Hi David, David Caldwell 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