From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Caldwell Newsgroups: gmane.emacs.devel Subject: Re: url-encode-url: do not add a trailing slash for "bare" =?utf-8?b?VVJMcwkod2l0aA==?= no file/directory) Date: Wed, 12 Mar 2014 22:28:11 +0000 (UTC) Message-ID: 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; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1394663415 31901 80.91.229.3 (12 Mar 2014 22:30:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 12 Mar 2014 22:30:15 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Mar 12 23:30:24 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 1WNrfM-0000Q8-Em for ged-emacs-devel@m.gmane.org; Wed, 12 Mar 2014 23:30:24 +0100 Original-Received: from localhost ([::1]:35240 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WNrfM-0001vP-1q for ged-emacs-devel@m.gmane.org; Wed, 12 Mar 2014 18:30:24 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48881) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WNrfE-0001oz-KL for emacs-devel@gnu.org; Wed, 12 Mar 2014 18:30:21 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WNrf5-0000jD-CR for emacs-devel@gnu.org; Wed, 12 Mar 2014 18:30:16 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:56557) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WNrf5-0000fa-5T for emacs-devel@gnu.org; Wed, 12 Mar 2014 18:30:07 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1WNrf1-00005G-Qu for emacs-devel@gnu.org; Wed, 12 Mar 2014 23:30:04 +0100 Original-Received: from cpe-142-11-95-13.socal.rr.com ([142.11.95.13]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 12 Mar 2014 23:30:03 +0100 Original-Received: from david by cpe-142-11-95-13.socal.rr.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 12 Mar 2014 23:30:03 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 52 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: sea.gmane.org User-Agent: Loom/3.14 (http://gmane.org/) X-Loom-IP: 142.11.95.13 (Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:28.0) Gecko/20100101 Firefox/28.0) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 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:170305 Archived-At: Bastien gnu.org> writes: > > Hi Stefan, > > Stefan Monnier iro.umontreal.ca> writes: > > >> The following trivial patch changes this. > > > > I'm no expert on URL conventions, but it looks OK to me, tho maybe the / > > is needed when there's a fragment. 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. > 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. That being said, there's no point at all to elide the / at the root. With other paths there's a difference at the http level: http://gnu.org/emacs/ -> http command "GET /emacs/" http://gnu.org/emacs -> http command "GET /emacs" But the root one doesn't change: http://gnu.org/ -> http command "GET /" http://gnu.org -> http command "GET /" …since it's not valid http to just say "GET". -David