From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Vivien Kraus Newsgroups: gmane.lisp.guile.devel Subject: Re: [PATCH v4] Add resolve-relative-reference in (web uri), as in RFC 3986 5.2. Date: Mon, 27 Nov 2023 18:10:34 +0100 Message-ID: <44f50f84a0cb18824d431eb805e2b3963a3776f6.camel@planete-kraus.eu> References: <87fs1n53de.fsf@nborghese.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5166"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Evolution 3.46.4 Cc: Nathan To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Mon Nov 27 18:12:04 2023 Return-path: Envelope-to: guile-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1r7f9Q-00018m-TT for guile-devel@m.gmane-mx.org; Mon, 27 Nov 2023 18:12:04 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r7f8W-0005aE-Db; Mon, 27 Nov 2023 12:11:12 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r7f8C-0005Rr-CV for guile-devel@gnu.org; Mon, 27 Nov 2023 12:10:49 -0500 Original-Received: from planete-kraus.eu ([89.234.140.182]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.90_1) (envelope-from ) id 1r7f84-00056a-Pg for guile-devel@gnu.org; Mon, 27 Nov 2023 12:10:48 -0500 Original-Received: from planete-kraus.eu (localhost.lan [127.0.0.1]) by planete-kraus.eu (OpenSMTPD) with ESMTP id 6aaf5501; Mon, 27 Nov 2023 17:10:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=planete-kraus.eu; h= message-id:subject:from:to:cc:date:in-reply-to:references :content-type:content-transfer-encoding:mime-version; s= albinoniA; bh=r+LiOHOwhnIUdfdLAyEdN4Hb7DE=; b=wvY2EpEoWJu+cwafP5 TEybAlyLFycWpW3Iuzx9KE9K8We5lb9tuXHnGah8hdxZzfirUKgCEkSdFP9ZeFIk UkAaXYXw9bKFy5W7/BMKxBQM2X+wHNFOGqUetPNbMK7NQvwMlgp/WdLRn8DwEcKT jZy17uti2ECOsDUgTgF8m1hR1ra9aqLEFZM0UdJYEpgq26Xa80DyLDPyEPz+JnK2 7HEr+AKksBBiMbjZ7ZkXkXQTnGqDwZbSilqgwyX6Y5t22x8w8Qps12pc/ucIq7XF t21amiqyolDbM3gB+a2aeKXM3XJwmI9Ij6Wa1GYBaSIEUv1W78n7bJ7GWvpZOTji x4zg== Original-Received: by planete-kraus.eu (OpenSMTPD) with ESMTPSA id f2bdca6d (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO); Mon, 27 Nov 2023 17:10:36 +0000 (UTC) In-Reply-To: <87fs1n53de.fsf@nborghese.com> Received-SPF: pass client-ip=89.234.140.182; envelope-from=vivien@planete-kraus.eu; helo=planete-kraus.eu X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.devel:22127 Archived-At: Dear Guile developers, Some time ago, Nathan wrote this patch as a better version of mine, and I would really like to see it merged. Does it need more improvement? I consider it pretty good. Best regards, Vivien Le jeudi 02 novembre 2023 =C3=A0 16:00 -0400, Nathan a =C3=A9crit=C2=A0: > There is a problem and I fixed it by rewriting a bunch of code myself > because I need similar code. >=20 > remove-dot-segments: > You cannot split-and-decode-uri-path and then encode-and-join-uri- > path. > Those are terrible functions that don't work on all URIs. > URI schemes are allowed to specify that certain reserved characters > (sub-delims) are special. > In that case, a sub-delim that IS escaped is different from a sub- > delim that IS NOT escaped. >=20 > Example input to your remove-dot-segments: > (resolve-relative-reference (string->uri-reference "/") (string->uri- > reference "excitement://a.com/a!a!%21!")) > Your wrong output: > excitement://a.com/a%21a%21%21%21 >=20 > One solution would be to only percent-decode dots. Because dot is > unreserved, that solution doesn't have any URI equivalence issues. > But I still think decoding dots automatically is a bad, unexpected > side-effect to have. > I rewrote this function so that it: > - works on both escaped and unescaped dots > - doesn't unescape any unnecessary characters >=20 > The test suite no longer needs to check for incorrect output either: > > ;; The test suite checks for ';' characters, but Guile escapes > > ;; them in URIs. Same for '=3D'. >=20 > ---- >=20 > resolve-relative-reference: > I rewrote this procedure so it is shorter. > I also added #:strict? to toggle "strict parser" as mentioned in the > RFC. >=20 > - Nathan