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

From: Ludovic Courtès <[email-masked]>
Date: Thu, 03 Dec 2020 18:01:05 +0100

Hi,

Hartmut Goebel <[email-masked]> skribis:

> 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);

To begin with, we could define ‘url-append’ in (guix http-client), say,
and use it in (guix scripts substitute).

Eventually it would be nice to have that in (web uri).

Thoughts?

Ludo’.