Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 1 Mar 2022 14:45:25 +0100
From:      Ronald Klop <ronald-lists@klop.ws>
To:        Aristedes Maniatis <ari@ish.com.au>, freebsd-ports@FreeBSD.org
Subject:   Re: pkgs contain non URL safe characters
Message-ID:  <ad3f17b6-d946-fbb6-493b-4899c985bff6@klop.ws>
In-Reply-To: <378a27ca-dbfe-d6f4-45f6-2ff90265874e@ish.com.au>
References:  <e4f8bec4-e2c7-154c-0e49-109718782725@ish.com.au> <e0aea756-b7c3-b9bf-9dc7-b34c91399b31@ish.com.au> <e4f364c7-a2ef-7b03-77af-2d8dd8299b80@klop.ws> <378a27ca-dbfe-d6f4-45f6-2ff90265874e@ish.com.au>

next in thread | previous in thread | raw e-mail | index | archive | help
On 3/1/22 14:25, Aristedes Maniatis wrote:
> On 1/3/2022 10:57pm, Ronald Klop wrote:
> 
>>
>> The + character is not special in this part of the URL. The request send by pkg is compliant to the specs.
>>
>> I'm aware of having specs and having what browsers and servers do in real life.
>> Why does Cloudfront decode a + to a space in this part of the URL?
>>
>> Regards,
>> Ronald.
> 
> 
> You are exactly correct. Turns out that AWS S3 is not following RFC 1866 <https://datatracker.ietf.org/doc/html/rfc1866>; and hasn't since the beginning. And I'm guessing it is now too late. With this new information I've finally found a thread complaining about this (it affects other repos like apt).
> 
> https://forums.aws.amazon.com/thread.jspa?threadID=55746
> 
> 
> My little hack of renaming openjdk packages will have to stay I guess.
> 
> 
> Thanks
> 
> Ari
> 


You could try the untested patch below as "compatibility fix", but I'm not sure if that will not break other valid URLs passed to fetch/pkg.
Apparently pkg embeds libfetch statically: https://github.com/freebsd/pkg/tree/master/external/libfetch .
This patch is against the FreeBSD base.

diff --git a/lib/libfetch/fetch.c b/lib/libfetch/fetch.c
index 82a3c5e451a..496425cea47 100644
--- a/lib/libfetch/fetch.c
+++ b/lib/libfetch/fetch.c
@@ -451,7 +451,7 @@ fetchParseURL(const char *URL)
                 }
                 u->doc = doc;
                 while (*p != '\0') {
-                       if (!isspace((unsigned char)*p)) {
+                       if (!isspace((unsigned char)*p) && *p != '+') {
                                 *doc++ = *p++;
                         } else {
                                 *doc++ = '%';




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ad3f17b6-d946-fbb6-493b-4899c985bff6>