GNU bug report logs - #78640
elisp url.el cannot handle some valid URLs

Previous Next

Package: emacs;

Reported by: 林羽 <0713ws <at> gmail.com>

Date: Fri, 30 May 2025 03:59:02 UTC

Severity: normal

Tags: fixed

Fixed in version 31.1

Done: Robert Pluim <rpluim <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #17 received at 78640 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 78640 <at> debbugs.gnu.org,
 林羽 <0713ws <at> gmail.com>
Subject: Re: bug#78640: elisp url.el cannot handle some valid URLs
Date: Mon, 09 Jun 2025 12:01:23 +0200
On Jun 09 2025, Robert Pluim wrote:

> diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el
> index 4258da33a33..5a8279a4122 100644
> --- a/lisp/url/url-http.el
> +++ b/lisp/url/url-http.el
> @@ -325,8 +325,12 @@ url-http-create-request
>  					  url-http-target-url)
>                                           nil 'any nil)))
>           (ref-url (url-http--encode-string url-http-referer)))
> -    (if (equal "" real-fname)
> -	(setq real-fname "/"))
> +    (cond ((equal "" real-fname)
> +	   (setq real-fname "/"))
> +          ;; RFC 3986 section 6.2.3 says an empty path should be
> +          ;; normalized to "/".  (Bug#78640)
> +          ((not (eq (aref real-fname 0) ?/))
> +           (setq real-fname (concat "/" real-fname))))

The two conditions could be combined since (concat "/" real-fname) also
works if real-fname is "".

  (if (not (string-match-p "\\`/" real-fname))
      (setq real-fname (concat "/" real-fname)))

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."




This bug report was last modified 30 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.