[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#44906: Substitute requests fail if URL has trailing slash
From: |
Mark H Weaver |
Subject: |
bug#44906: Substitute requests fail if URL has trailing slash |
Date: |
Thu, 03 Dec 2020 23:15:45 -0500 |
Hi,
Ludovic Courtès <ludo@gnu.org> writes:
> Hartmut Goebel <h.goebel@crazy-compilers.com> 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).
Note that 'resolve-uri-reference' in (guix build download) implements
the algorithm specified in RFC 3986 section 5.2.2, for purposes of
supporting HTTP redirects. Perhaps some of that code will be useful.
Regards,
Mark