Subject: bug#8622: 24.0.50; url-parse does not implement RFC3986 5.2

From: Julien Danjou <[email-masked]>
Date: Sun, 11 Sep 2011 17:53:37 +0200

On Sun, Sep 11 2011, Andreas Schwab wrote:
> In which way does it not work?  There is the scheme "http", the host
> "a", the port 80 and the local part "/../../../g".  Everything is fully
> correct according to the rules of a URI.  How the local part is
> interpreted is only defined by the remote host.

Men, this is getting me crazy. Let me rephrase the whole thing.

You got an URL of the form:

    http://a/../../../foobar.png

If you use Firefox, Chromium, wget, or whatever to retrieve it, the
program will act according to RFC3986 and transform that URL to:

    http://a/foobar.png

`url' from Emacs will not, and will fail to retrieve the image.

Now I may be mistaken about where in the code the bug is, but there's a
bug: the `url' functions are unable to fetch such an URL, whereas any
other tool is able to.

In Lisp:

(switch-to-buffer (url-retrieve-synchronously
  "http://www.gnu.org/graphics/t-desktop-4-small.jpg"))
=> That works

(switch-to-buffer (url-retrieve-synchronously
  "http://www.gnu.org/../graphics/t-desktop-4-small.jpg"))
=> Show a 400 bad request

% wget http://www.gnu.org/../graphics/t-desktop-4-small.jpg
--2011-09-11 17:52:56--  http://www.gnu.org/graphics/t-desktop-4-small.jpg
Resolving www.gnu.org (www.gnu.org)... 140.186.70.148
Connecting to www.gnu.org (www.gnu.org)|140.186.70.148|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 30195 (29K) [image/jpeg]
Saving to: `t-desktop-4-small.jpg'

100%[=======================================================================================================================================================================================================================================>] 30,195      66.5K/s   in 0.4s    

2011-09-11 17:52:56 (66.5 KB/s) - `t-desktop-4-small.jpg' saved [30195/30195]

-- 
Julien Danjou
❱ http://julien.danjou.info