From nobody Thu Feb 17 02:05:35 2022 X-Original-To: freebsd-ports@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E6F2E19B8BB2 for ; Thu, 17 Feb 2022 02:42:29 +0000 (UTC) (envelope-from ari@ish.com.au) Received: from mail.ish.com.au (203-129-16-229.cb8110.syd.nbn.aussiebb.net [203.129.16.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4JzfHm2PBtz4tRC for ; Thu, 17 Feb 2022 02:42:28 +0000 (UTC) (envelope-from ari@ish.com.au) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ish.com.au; s=mail; h=In-Reply-To:References:To:From:Subject:MIME-Version:Date:Message-ID :Content-Type:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=nqmT+XAGJaY8OULiZvVpj/vJDivK/juXvFDBXxqUYZ4=; b=Bf9XYQSJoDxFuRduNOtnZ4KrlC i+6+kBcAm3jVmXPWOEpxYIwuUqN2SlA7M8ppwBVdLemVe/qIgtUWiyp0NePQ15iZ15SW1XlquXRj1 SLu7zcLndOZabxePP81iGM7IUsX92nuxf5e5qxbuAMFx1XTvD0RAxrfTVs3LnSjiroE3fiJCik5c3 kPEZS7xtWxs9OeCLpo8wz7OyW0GjEFV3hKHd5drvaV7SdI4Ifm0hNaGNpxKAUo0GGgjnG3KtPHY2b 5M0JTyF2k8KARDg8/RWV6fc4Z21uL3iNSRiIOZZo6CRpHfdpPoBox7I7gJlsgf3Ri4sqPazJyDsoZ pPLsK27Q==; Received: from [10.29.63.10] by mail.ish.com.au with esmtpsa (TLS1.3) tls TLS_AES_128_GCM_SHA256 (Exim 4.95 (FreeBSD)) (envelope-from ) id 1nKWAI-000DKH-HR for freebsd-ports@FreeBSD.org; Thu, 17 Feb 2022 13:05:02 +1100 Content-Type: multipart/alternative; boundary="------------G695vUoiivf6HvwjCgbcLrYi" Message-ID: Date: Thu, 17 Feb 2022 13:05:35 +1100 List-Id: Porting software to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-ports List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-ports@freebsd.org X-BeenThere: freebsd-ports@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.6.0 Subject: Re: pkgs contain non URL safe characters Content-Language: en-US From: Aristedes Maniatis To: freebsd-ports@FreeBSD.org References: In-Reply-To: X-Rspamd-Queue-Id: 4JzfHm2PBtz4tRC X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=ish.com.au header.s=mail header.b=Bf9XYQSJ; dmarc=pass (policy=quarantine) header.from=ish.com.au; spf=pass (mx1.freebsd.org: domain of ari@ish.com.au designates 203.129.16.229 as permitted sender) smtp.mailfrom=ari@ish.com.au X-Spamd-Result: default: False [-3.99 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[ish.com.au:s=mail]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_SPF_ALLOW(-0.20)[+mx]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; TO_DN_NONE(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; DKIM_TRACE(0.00)[ish.com.au:+]; DMARC_POLICY_ALLOW(-0.50)[ish.com.au,quarantine]; NEURAL_HAM_SHORT(-0.99)[-0.991]; MLMMJ_DEST(0.00)[freebsd-ports]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:4764, ipnet:203.129.16.0/22, country:AU]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] X-ThisMailContainsUnwantedMimeParts: N This is a multi-part message in MIME format. --------------G695vUoiivf6HvwjCgbcLrYi Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Just to check this behaviour, I used tcpdump to see what the request looked like from pkg-fetch.     123.ish.com.au.15580 > pkg0.twn.freebsd.org.http: Flags [P.], cksum 0x80e0 (incorrect -> 0xfc82), seq 1:184, ack 1, win 1027, options [nop,nop,TS val 975600196 ecr 3136747760], length 183: HTTP, length: 183     GET /FreeBSD:13:amd64/quarterly/All/openjdk11-11.0.13+8.1.pkg HTTP/1.1     Host: pkgmir.geo.freebsd.org     Accept: */*     User-Agent: pkg/1.17.5     Range: bytes=6733824-     Connection: close You can see in there that the + is not URL encoded. Is it expected that pkg uses URL standards for its repository? If not, any advice on how to host a repository on a commercial service like AWS cloudfront? Should we rewrite all our files with + symbols to spaces? Should pkg names only contain URL safe characters? Or should pkg-fetch be fixed to encode URLs? I took a quick look at the source for pkg.c and where it calls fetchXGet but I can't understand where any URL encoding might happen. Ari On 14/2/2022 11:18am, Aristedes Maniatis wrote: > Some packages contain "+" symbol which is a way of encoding spaces in > a URL. This means that I'm having trouble hosting our pkg repository > behind cloudfront/S3. > > I wasn't sure where to post this issue, so I put more details here: > https://github.com/freebsd/poudriere/issues/976 > > > Is there a workaround for this issue? Could pkg-fetch escape such > characters when interacting with a http repository? > > > Cheers > > Ari > > --------------G695vUoiivf6HvwjCgbcLrYi Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

Just to check this behaviour, I used tcpdump to see what the request looked like from pkg-fetch.


    123.ish.com.au.15580 > pkg0.twn.freebsd.org.http: Flags [P.], cksum 0x80e0 (incorrect -> 0xfc82), seq 1:184, ack 1, win 1027, options [nop,nop,TS val 975600196 ecr 3136747760], length 183: HTTP, length: 183
    GET /FreeBSD:13:amd64/quarterly/All/openjdk11-11.0.13+8.1.pkg HTTP/1.1
    Host: pkgmir.geo.freebsd.org
    Accept: */*
    User-Agent: pkg/1.17.5
    Range: bytes=6733824-
    Connection: close


You can see in there that the + is not URL encoded. Is it expected that pkg uses URL standards for its repository? If not, any advice on how to host a repository on a commercial service like AWS cloudfront?

Should we rewrite all our files with + symbols to spaces? Should pkg names only contain URL safe characters? Or should pkg-fetch be fixed to encode URLs?


I took a quick look at the source for pkg.c and where it calls fetchXGet but I can't understand where any URL encoding might happen.


Ari


On 14/2/2022 11:18am, Aristedes Maniatis wrote:
Some packages contain "+" symbol which is a way of encoding spaces in a URL. This means that I'm having trouble hosting our pkg repository behind cloudfront/S3.

I wasn't sure where to post this issue, so I put more details here: https://github.com/freebsd/poudriere/issues/976


Is there a workaround for this issue? Could pkg-fetch escape such characters when interacting with a http repository?


Cheers

Ari


--------------G695vUoiivf6HvwjCgbcLrYi--