Subject: Re: bug#44906: Substitute requests fail if URL has trailing slash

From: Hartmut Goebel <[email-masked]>
Date: Sat, 28 Nov 2020 10:47:31 +0100

Am 28.11.20 um 00:37 schrieb zimoun:
> Now, the question is where should the fix go?  “guix publish” exposing
> the narinfos or “guix weather“?  Or both?

I propose fixing all places where string-append is used to join URLs, 
since joining URLs is not the same as string concatenation. We might 
restrict our algorithm to only joining a path. 
<https://tools.ietf.org/html/rfc3986#section-5.2.2> shows the complete 
algorithm, where this is the relevant part for only joining a path 
(R.path) to a base URL's path (T.path).

                if (R.path starts-with "/") then
                   T.path = remove_dot_segments(R.path);
                else
                   T.path = merge(Base.path, R.path);
                   T.path = remove_dot_segments(T.path);

(Side-node: guile module (web uri) 
<https://www.gnu.org/software/guile/manual/html_node/URIs.html> seems to 
lack respective, easy to use functions.)

-- 
Regards
Hartmut Goebel

| Hartmut Goebel          | [email-masked]               |
| www.crazy-compilers.com | compilers which you thought are impossible |